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>,
) -> DMatrix<f64>
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>) -> DVector<f64>
where R: Dim,
C: Dim,
S: Storage<f64, R, C>;
fn parameters(&self) -> DVector<f64>;
fn reparameterize(&self, params: &[f64]) -> Result<Self, KernelError>;
fn covariance_with_gradient<R, C, S>(
&self,
x: &Matrix<f64, R, C, S>,
) -> Result<(DMatrix<f64>, CovGrad), CovGradError>
where R: Dim,
C: Dim,
S: Storage<f64, R, C>;
// Provided methods
fn consume_parameters<I: IntoIterator<Item = f64>>(
&self,
params: I,
) -> Result<(Self, I::IntoIter), KernelError> { ... }
fn add<B: Kernel>(self, other: B) -> AddKernel<Self, B> { ... }
fn mul<B: Kernel>(self, other: B) -> ProductKernel<Self, B> { ... }
}
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>,
) -> DMatrix<f64>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>,
) -> DMatrix<f64>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>) -> DVector<f64>
fn diag<R, C, S>(&self, x: &Matrix<f64, R, C, S>) -> DVector<f64>
Returns the diagonal of the kernel(x, x)
sourcefn parameters(&self) -> DVector<f64>
fn parameters(&self) -> DVector<f64>
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: IntoIterator<Item = f64>>(
&self,
params: I,
) -> Result<(Self, I::IntoIter), KernelError>
fn consume_parameters<I: IntoIterator<Item = f64>>( &self, params: I, ) -> Result<(Self, I::IntoIter), KernelError>
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: Kernel>(self, other: B) -> AddKernel<Self, B>
fn mul<B: Kernel>(self, other: B) -> ProductKernel<Self, B>
Object Safety§
This trait is not object safe.