Struct rusty_machine::learning::toolkit::kernel::SquaredExp
source · [−]pub struct SquaredExp {
pub ls: f64,
pub ampl: f64,
}
Expand description
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.
Implementations
sourceimpl SquaredExp
impl SquaredExp
sourcepub fn new(ls: f64, ampl: f64) -> SquaredExp
pub 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
sourceimpl Clone for SquaredExp
impl Clone for SquaredExp
sourcefn clone(&self) -> SquaredExp
fn clone(&self) -> SquaredExp
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 SquaredExp
impl Debug for SquaredExp
sourceimpl Default for SquaredExp
impl Default for SquaredExp
Constructs the default Squared Exp kernel.
The defaults are:
- ls = 1
- ampl = 1
sourcefn default() -> SquaredExp
fn default() -> SquaredExp
Returns the “default value” for a type. Read more
sourceimpl Kernel for SquaredExp
impl Kernel for SquaredExp
impl Copy for SquaredExp
Auto Trait Implementations
impl RefUnwindSafe for SquaredExp
impl Send for SquaredExp
impl Sync for SquaredExp
impl Unpin for SquaredExp
impl UnwindSafe for SquaredExp
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