Skip to main content

KernelFunction

Trait KernelFunction 

Source
pub trait KernelFunction<T> {
    // Required methods
    fn compute(&self, a: &[T], b: &[T]) -> Result<T, SimdError>;
    fn kernel_matrix(&self, vectors: &[&[T]]) -> Result<Vec<Vec<T>>, SimdError>;
    fn name(&self) -> &'static str;
    fn has_parameters(&self) -> bool;
}
Expand description

Trait for kernel functions used in SVM and other algorithms

Required Methods§

Source

fn compute(&self, a: &[T], b: &[T]) -> Result<T, SimdError>

Compute the kernel function between two vectors

Source

fn kernel_matrix(&self, vectors: &[&[T]]) -> Result<Vec<Vec<T>>, SimdError>

Compute kernel matrix for a set of vectors

Source

fn name(&self) -> &'static str

Get the name of the kernel function

Source

fn has_parameters(&self) -> bool

Check if kernel supports hyperparameters

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§