pub struct Polynomial {
    pub alpha: f64,
    pub c: f64,
    pub d: f64,
}
Expand description

The Polynomial Kernel

k(x,y) = (αxTy + c)d

Fields

alpha: f64

Scaling of the inner product.

c: f64

Constant added to inner product.

d: f64

The power to raise the sum to.

Implementations

Constructs a new Polynomial Kernel.

Examples
use rusty_machine::learning::toolkit::kernel;
use rusty_machine::learning::toolkit::kernel::Kernel;

// Constructs a new polynomial with alpha = 1, c = 0, d = 2.
let ker = kernel::Polynomial::new(1.0, 0.0, 2.0);

println!("{0}", ker.kernel(&[1.,2.,3.], &[3.,4.,5.]));

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Construct a new polynomial kernel.

The defaults are:

  • alpha = 1
  • c = 0
  • d = 1
Returns the “default value” for a type. Read more
The kernel function. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.