Struct rusty_machine::learning::toolkit::kernel::Polynomial [] [src]

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

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.

Methods

impl Polynomial
[src]

fn new(alpha: f64, c: f64, d: f64) -> Polynomial

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

impl Debug for Polynomial
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Copy for Polynomial
[src]

impl Clone for Polynomial
[src]

fn clone(&self) -> Polynomial

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Default for Polynomial
[src]

Construct a new polynomial kernel.

The defaults are:

fn default() -> Polynomial

Returns the "default value" for a type. Read more

impl Kernel for Polynomial
[src]

fn kernel(&self, x1: &[f64], x2: &[f64]) -> f64

The kernel function. Read more