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§
Source§impl 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§
Source§impl Clone for SquaredExp
impl Clone for SquaredExp
Source§fn clone(&self) -> SquaredExp
fn clone(&self) -> SquaredExp
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SquaredExp
impl Debug for SquaredExp
Source§impl Default for SquaredExp
Constructs the default Squared Exp kernel.
impl Default for SquaredExp
Constructs the default Squared Exp kernel.
The defaults are:
- ls = 1
- ampl = 1
Source§fn default() -> SquaredExp
fn default() -> SquaredExp
Returns the “default value” for a type. Read more
Source§impl Kernel for SquaredExp
impl Kernel for SquaredExp
impl Copy for SquaredExp
Auto Trait Implementations§
impl Freeze for SquaredExp
impl RefUnwindSafe for SquaredExp
impl Send for SquaredExp
impl Sync for SquaredExp
impl Unpin for SquaredExp
impl UnwindSafe for SquaredExp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more