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

pub struct SquaredExp {
    pub ls: f64,
    pub ampl: f64,
}

Squared exponential kernel

Equivalently a gaussian function.

k(x,y) = A exp(-||x-y||2 / 2l2)

Where A is the amplitude and l the length scale.

Fields

ls: f64

The length scale of the kernel.

ampl: f64

The amplitude of the kernel.

Methods

impl SquaredExp
[src]

fn new(ls: f64, ampl: f64) -> SquaredExp

Construct a new squared exponential kernel.

Examples

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

// Construct a kernel with lengthscale 2 and amplitude 1.
let ker = kernel::SquaredExp::new(2f64, 1f64);

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

Trait Implementations

impl Debug for SquaredExp
[src]

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

Formats the value using the given formatter.

impl Copy for SquaredExp
[src]

impl Clone for SquaredExp
[src]

fn clone(&self) -> SquaredExp

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

Constructs the default Squared Exp kernel.

The defaults are:

fn default() -> SquaredExp

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

impl Kernel for SquaredExp
[src]

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

The squared exponential kernel function.