Struct friedrich::kernel::Polynomial
source · Expand description
The Polynomial Kernel.
k(x,y) = (αx^Ty + c)^d
Fields§
§alpha: f64
Scaling of the inner product.
c: f64
Constant added to inner product.
d: f64
The power to raise the sum to.
Implementations§
source§impl Polynomial
impl Polynomial
Trait Implementations§
source§impl Clone for Polynomial
impl Clone for Polynomial
source§fn clone(&self) -> Polynomial
fn clone(&self) -> Polynomial
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 Polynomial
impl Debug for Polynomial
source§impl Default for Polynomial
impl Default for Polynomial
Construct a new polynomial kernel.
The defaults are:
- alpha = 1
- c = 0
- d = 1
source§fn default() -> Polynomial
fn default() -> Polynomial
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for Polynomial
impl<'de> Deserialize<'de> for Polynomial
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 Polynomial
impl Kernel for Polynomial
source§fn nb_parameters(&self) -> usize
fn nb_parameters(&self) -> usize
Numbers of parameters (such as bandwidth and amplitude) of the kernel. Read more
source§fn kernel<S1: Storage<f64, U1, Dynamic>, S2: Storage<f64, U1, Dynamic>>(
&self,
x1: &SRowVector<S1>,
x2: &SRowVector<S2>
) -> f64
fn kernel<S1: Storage<f64, U1, Dynamic>, S2: Storage<f64, U1, Dynamic>>(
&self,
x1: &SRowVector<S1>,
x2: &SRowVector<S2>
) -> f64
Takes two equal length slices (row vector) and returns a scalar. Read more
source§fn gradient<S1: Storage<f64, U1, Dynamic>, S2: Storage<f64, U1, Dynamic>>(
&self,
x1: &SRowVector<S1>,
x2: &SRowVector<S2>
) -> Vec<f64>
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 get_parameters(&self) -> Vec<f64>
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])
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 is_scalable(&self) -> bool
fn is_scalable(&self) -> bool
source§fn rescale(&mut self, _scale: f64)
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 moresource§fn heuristic_fit<SM: Storage<f64, Dynamic, Dynamic>, SV: Storage<f64, Dynamic, U1>>(
&mut self,
_training_inputs: &SMatrix<SM>,
_training_outputs: &SVector<SV>
)
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. Read more
source§impl Serialize for Polynomial
impl Serialize for Polynomial
impl Copy for Polynomial
Auto Trait Implementations§
impl RefUnwindSafe for Polynomial
impl Send for Polynomial
impl Sync for Polynomial
impl Unpin for Polynomial
impl UnwindSafe for Polynomial
Blanket Implementations§
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.