pub enum Kernel {
Linear,
Polynomial {
degree: u32,
gamma: f64,
coef0: f64,
},
Rbf {
gamma: f64,
},
Sigmoid {
gamma: f64,
coef0: f64,
},
}Expand description
A positive-definite similarity k(a, b) between two feature vectors.
Variants§
Linear
a · b
Polynomial
(γ a·b + coef0)^degree
Rbf
exp(-γ ‖a - b‖²)
Sigmoid
tanh(γ a·b + coef0) (not positive definite for all parameters)
Implementations§
Source§impl Kernel
impl Kernel
pub fn evaluate(&self, a: &[f64], b: &[f64]) -> f64
Sourcepub fn cross(&self, a: VR2D<'_>, b: VR2D<'_>) -> R2D
pub fn cross(&self, a: VR2D<'_>, b: VR2D<'_>) -> R2D
The cross-kernel K[i][j] = k(a_i, b_j) between the rows of a and b.
Sourcepub fn rbf_scaled(x: VR2D<'_>) -> Kernel
pub fn rbf_scaled(x: VR2D<'_>) -> Kernel
An RBF kernel with the common heuristic γ = 1 / (features · variance) of the data.
Trait Implementations§
impl Copy for Kernel
impl StructuralPartialEq for Kernel
Auto Trait Implementations§
impl Freeze for Kernel
impl RefUnwindSafe for Kernel
impl Send for Kernel
impl Sync for Kernel
impl Unpin for Kernel
impl UnsafeUnpin for Kernel
impl UnwindSafe for Kernel
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