pub struct TernaryKernel {
pub sigma: f64,
}Expand description
Kernel functions for ternary data.
Fields§
§sigma: f64Implementations§
Source§impl TernaryKernel
impl TernaryKernel
pub fn new(sigma: f64) -> Self
Sourcepub fn matching(&self, a: &[Ternary], b: &[Ternary]) -> f64
pub fn matching(&self, a: &[Ternary], b: &[Ternary]) -> f64
Ternary matching kernel: counts matching positions.
Sourcepub fn agreement(&self, a: &[Ternary], b: &[Ternary]) -> f64
pub fn agreement(&self, a: &[Ternary], b: &[Ternary]) -> f64
Ternary agreement kernel: +1 for same, -1 for opposite, 0 otherwise.
Sourcepub fn polynomial(
&self,
a: &[Ternary],
b: &[Ternary],
degree: i32,
offset: f64,
) -> f64
pub fn polynomial( &self, a: &[Ternary], b: &[Ternary], degree: i32, offset: f64, ) -> f64
Polynomial kernel for ternary vectors.
Sourcepub fn kernel_matrix(
&self,
data: &[Vec<Ternary>],
kernel_type: KernelType,
) -> Vec<Vec<f64>>
pub fn kernel_matrix( &self, data: &[Vec<Ternary>], kernel_type: KernelType, ) -> Vec<Vec<f64>>
Compute full kernel matrix for a set of ternary vectors.
Auto Trait Implementations§
impl Freeze for TernaryKernel
impl RefUnwindSafe for TernaryKernel
impl Send for TernaryKernel
impl Sync for TernaryKernel
impl Unpin for TernaryKernel
impl UnsafeUnpin for TernaryKernel
impl UnwindSafe for TernaryKernel
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