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

pub struct RationalQuadratic {
    pub alpha: f64,
    pub ls: f64,
}

The Rational Quadratic Kernel.

k(x,y) = (1 + ||x-y||2 / (2αl2))

Fields

alpha: f64

Controls inverse power and difference scale.

ls: f64

Length scale controls scale of difference.

Methods

impl RationalQuadratic
[src]

fn new(alpha: f64, ls: f64) -> RationalQuadratic

Constructs a new Rational Quadratic Kernel.

Examples

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

// Construct a kernel with alpha = 2, ls = 2.
let ker = kernel::RationalQuadratic::new(2.0, 2.0);

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

Trait Implementations

impl Debug for RationalQuadratic
[src]

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

Formats the value using the given formatter.

impl Copy for RationalQuadratic
[src]

impl Clone for RationalQuadratic
[src]

fn clone(&self) -> RationalQuadratic

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

The default Rational Qaudratic Kernel.

The defaults are:

fn default() -> RationalQuadratic

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

impl Kernel for RationalQuadratic
[src]

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

The kernel function. Read more