Struct rusty_machine::learning::toolkit::kernel::RationalQuadratic
source · [−]pub struct RationalQuadratic {
pub alpha: f64,
pub ls: f64,
}
Expand description
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.
Implementations
sourceimpl RationalQuadratic
impl RationalQuadratic
sourcepub fn new(alpha: f64, ls: f64) -> RationalQuadratic
pub 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
sourceimpl Clone for RationalQuadratic
impl Clone for RationalQuadratic
sourcefn clone(&self) -> RationalQuadratic
fn clone(&self) -> RationalQuadratic
Returns a copy of the value. Read more
1.0.0const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for RationalQuadratic
impl Debug for RationalQuadratic
sourceimpl Default for RationalQuadratic
impl Default for RationalQuadratic
The default Rational Qaudratic Kernel.
The defaults are:
- alpha = 1
- ls = 1
sourcefn default() -> RationalQuadratic
fn default() -> RationalQuadratic
Returns the “default value” for a type. Read more
sourceimpl Kernel for RationalQuadratic
impl Kernel for RationalQuadratic
impl Copy for RationalQuadratic
Auto Trait Implementations
impl RefUnwindSafe for RationalQuadratic
impl Send for RationalQuadratic
impl Sync for RationalQuadratic
impl Unpin for RationalQuadratic
impl UnwindSafe for RationalQuadratic
Blanket Implementations
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstablefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ToOwned for Twhere
T: Clone,
impl<T> ToOwned for Twhere
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
fn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. Read more