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

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

The Exponential Kernel

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

Where A is the amplitude and l is the length scale.

Fields

ls: f64

The length scale of the kernel.

ampl: f64

The amplitude of the kernel.

Methods

impl Exponential
[src]

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

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::Exponential::new(2f64, 1f64);

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

Trait Implementations

impl Default for Exponential
[src]

Constructs the default Exponential kernel.

The defaults are:

  • ls = 1
  • amplitude = 1

fn default() -> Exponential

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

impl Kernel for Exponential
[src]

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

The squared exponential kernel function.