pub trait Kernel:
Debug
+ Clone
+ PartialEq {
// Required methods
fn n_parameters(&self) -> usize;
fn covariance<R1, R2, C1, C2, S1, S2>(
&self,
x1: &Matrix<f64, R1, C1, S1>,
x2: &Matrix<f64, R2, C2, S2>,
) -> Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>
where R1: Dim,
R2: Dim,
C1: Dim,
C2: Dim,
S1: Storage<f64, R1, C1>,
S2: Storage<f64, R2, C2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>;
fn is_stationary(&self) -> bool;
fn diag<R, C, S>(
&self,
x: &Matrix<f64, R, C, S>,
) -> Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>
where R: Dim,
C: Dim,
S: Storage<f64, R, C>;
fn parameters(
&self,
) -> Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>;
fn reparameterize(&self, params: &[f64]) -> Result<Self, KernelError>;
fn covariance_with_gradient<R, C, S>(
&self,
x: &Matrix<f64, R, C, S>,
) -> Result<(Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>, CovGrad), CovGradError>
where R: Dim,
C: Dim,
S: Storage<f64, R, C>;
// Provided methods
fn consume_parameters<I>(
&self,
params: I,
) -> Result<(Self, <I as IntoIterator>::IntoIter), KernelError>
where I: IntoIterator<Item = f64> { ... }
fn add<B>(self, other: B) -> AddKernel<Self, B>
where B: Kernel { ... }
fn mul<B>(self, other: B) -> ProductKernel<Self, B>
where B: Kernel { ... }
}Expand description
Kernel Function
Required Methods§
Sourcefn n_parameters(&self) -> usize
fn n_parameters(&self) -> usize
Return the number of parameters used in this Kernel.
Sourcefn covariance<R1, R2, C1, C2, S1, S2>(
&self,
x1: &Matrix<f64, R1, C1, S1>,
x2: &Matrix<f64, R2, C2, S2>,
) -> Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>where
R1: Dim,
R2: Dim,
C1: Dim,
C2: Dim,
S1: Storage<f64, R1, C1>,
S2: Storage<f64, R2, C2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
fn covariance<R1, R2, C1, C2, S1, S2>(
&self,
x1: &Matrix<f64, R1, C1, S1>,
x2: &Matrix<f64, R2, C2, S2>,
) -> Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>where
R1: Dim,
R2: Dim,
C1: Dim,
C2: Dim,
S1: Storage<f64, R1, C1>,
S2: Storage<f64, R2, C2>,
ShapeConstraint: SameNumberOfColumns<C1, C2>,
Returns the covariance matrix for two equal sized vectors
Sourcefn is_stationary(&self) -> bool
fn is_stationary(&self) -> bool
Reports if the given kernel function is stationary.
Sourcefn diag<R, C, S>(
&self,
x: &Matrix<f64, R, C, S>,
) -> Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>
fn diag<R, C, S>( &self, x: &Matrix<f64, R, C, S>, ) -> Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>
Returns the diagonal of the kernel(x, x)
Sourcefn parameters(
&self,
) -> Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>
fn parameters( &self, ) -> Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>
Return the corresponding parameter vector The parameters here are in a log-scale
Sourcefn reparameterize(&self, params: &[f64]) -> Result<Self, KernelError>
fn reparameterize(&self, params: &[f64]) -> Result<Self, KernelError>
Create a new kernel of the given type from the provided parameters. The parameters here are in a log-scale
Provided Methods§
Sourcefn consume_parameters<I>(
&self,
params: I,
) -> Result<(Self, <I as IntoIterator>::IntoIter), KernelError>where
I: IntoIterator<Item = f64>,
fn consume_parameters<I>(
&self,
params: I,
) -> Result<(Self, <I as IntoIterator>::IntoIter), KernelError>where
I: IntoIterator<Item = f64>,
Takes a sequence of parameters and consumes only the ones it needs to create itself. The parameters here are in a log-scale
fn add<B>(self, other: B) -> AddKernel<Self, B>where
B: Kernel,
fn mul<B>(self, other: B) -> ProductKernel<Self, B>where
B: Kernel,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.