pub struct SpectralMixtureKernel { /* private fields */ }Expand description
Spectral Mixture (SM) kernel.
K(x, y) = Σ_q w_q * exp(-2π² * Σ_d (x_d - y_d)² * v_q,d) * cos(2π * Σ_d (x_d - y_d) * μ_q,d)
where:
- w_q is the weight of component q
- μ_q,d is the mean frequency of component q in dimension d
- v_q,d is the variance of component q in dimension d
This kernel can approximate any stationary covariance function arbitrarily well as the number of components increases.
Implementations§
Source§impl SpectralMixtureKernel
impl SpectralMixtureKernel
Sourcepub fn new(components: Vec<SpectralComponent>) -> Result<Self>
pub fn new(components: Vec<SpectralComponent>) -> Result<Self>
Create a new Spectral Mixture kernel.
§Arguments
components- List of spectral components
§Example
use tensorlogic_sklears_kernels::spectral_kernel::{SpectralMixtureKernel, SpectralComponent};
use tensorlogic_sklears_kernels::Kernel;
// Create a kernel with two periodic components
let components = vec![
SpectralComponent::new_1d(1.0, 0.1, 0.01).unwrap(), // Low frequency
SpectralComponent::new_1d(0.5, 1.0, 0.1).unwrap(), // High frequency
];
let kernel = SpectralMixtureKernel::new(components).unwrap();Sourcepub fn new_1d(frequencies: Vec<(f64, f64, f64)>) -> Result<Self>
pub fn new_1d(frequencies: Vec<(f64, f64, f64)>) -> Result<Self>
Create a simple 1D spectral mixture kernel with given frequencies.
§Arguments
frequencies- List of (weight, mean_frequency, variance) tuples
Sourcepub fn components(&self) -> &[SpectralComponent]
pub fn components(&self) -> &[SpectralComponent]
Get the components.
Sourcepub fn num_components(&self) -> usize
pub fn num_components(&self) -> usize
Get the number of components.
Trait Implementations§
Source§impl Clone for SpectralMixtureKernel
impl Clone for SpectralMixtureKernel
Source§fn clone(&self) -> SpectralMixtureKernel
fn clone(&self) -> SpectralMixtureKernel
Returns a duplicate 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 SpectralMixtureKernel
impl Debug for SpectralMixtureKernel
Auto Trait Implementations§
impl Freeze for SpectralMixtureKernel
impl RefUnwindSafe for SpectralMixtureKernel
impl Send for SpectralMixtureKernel
impl Sync for SpectralMixtureKernel
impl Unpin for SpectralMixtureKernel
impl UnwindSafe for SpectralMixtureKernel
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more