Struct SquaredExp

Source
pub struct SquaredExp {
    pub ls: f64,
    pub ampl: f64,
}
Expand description

Squared exponential kernel

Equivalent to a gaussian kernel.

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

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

Source

pub fn new(ls: f64, ampl: f64) -> SquaredExp

Construct a new squared exponential kernel (gaussian).

Trait Implementations§

Source§

impl Clone for SquaredExp

Source§

fn clone(&self) -> SquaredExp

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SquaredExp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SquaredExp

Constructs the default Squared Exp kernel.

The defaults are:

  • ls = 1
  • ampl = 1
Source§

fn default() -> SquaredExp

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SquaredExp

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Kernel for SquaredExp

Source§

fn kernel<S1: Storage<f64, U1, Dynamic>, S2: Storage<f64, U1, Dynamic>>( &self, x1: &SRowVector<S1>, x2: &SRowVector<S2>, ) -> f64

The squared exponential kernel function.

Source§

fn nb_parameters(&self) -> usize

Numbers of parameters (such as bandwidth and amplitude) of the kernel. Read more
Source§

fn is_scalable(&self) -> bool

Can the kernel be rescaled (see the rescale function) ? This value is false by default. Read more
Source§

fn gradient<S1: Storage<f64, U1, Dynamic>, S2: Storage<f64, U1, Dynamic>>( &self, x1: &SRowVector<S1>, x2: &SRowVector<S2>, ) -> Vec<f64>

Takes two equal length slices (row vector) and returns a vector containing the value of the gradient for each parameter in an arbitrary order. Read more
Source§

fn rescale(&mut self, scale: f64)

Multiplies the amplitude of the kernel by the scale parameter such that a kernel a*K(x,y) becomes scale*a*K(x,y). Read more
Source§

fn get_parameters(&self) -> Vec<f64>

Returns a vector containing all the parameters of the kernel in the same order as the outputs of the gradient function.
Source§

fn set_parameters(&mut self, parameters: &[f64])

Sets all the parameters of the kernel by reading them from a slice where they are in the same order as the outputs of the gradient function.
Source§

fn heuristic_fit<SM: Storage<f64, Dynamic, Dynamic>, SV: Storage<f64, Dynamic, U1>>( &mut self, training_inputs: &SMatrix<SM>, training_outputs: &SVector<SV>, )

Optional, function that fits the kernel parameters on the training data using fast heuristics. This is used as a starting point for gradient descent.
Source§

impl Serialize for SquaredExp

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for SquaredExp

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,