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

pub struct Linear {
    pub c: f64,
}

The Linear Kernel

k(x,y) = xTy + c

Fields

c: f64

Constant term added to inner product.

Methods

impl Linear
[src]

fn new(c: f64) -> Linear

Constructs a new Linear Kernel.

Examples

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

let ker = kernel::Linear::new(5.0);

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

Trait Implementations

impl Debug for Linear
[src]

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

Formats the value using the given formatter.

impl Copy for Linear
[src]

impl Clone for Linear
[src]

fn clone(&self) -> Linear

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 Linear
[src]

Constructs the default Linear Kernel

The defaults are:

fn default() -> Linear

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

impl Kernel for Linear
[src]

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

The kernel function. Read more