pub struct BinarySVM<const D: usize, K>where
K: Kernel<D>,{ /* private fields */ }Expand description
A fitted binary classification support vector machine.
§Type Parameters
D- The dimension or number of features.K- The type of the kernel function.
Implementations§
Source§impl<const D: usize, K> BinarySVM<D, K>where
K: Kernel<D>,
impl<const D: usize, K> BinarySVM<D, K>where
K: Kernel<D>,
Sourcepub fn predict(&self, x: &RowVector<D>) -> bool
pub fn predict(&self, x: &RowVector<D>) -> bool
Predicts the class label for a given input vector.
Sourcepub fn decision_function(&self, x: &RowVector<D>) -> f32
pub fn decision_function(&self, x: &RowVector<D>) -> f32
Computes the decision value for a given input vector.
This is useful for getting a confidence score. A larger positive value indicates higher confidence in the positive class, while a larger negative value indicates higher confidence in the negative class.
Sourcepub fn support_vectors(&self) -> impl Iterator<Item = &FittedSVMDataPoint<D>>
pub fn support_vectors(&self) -> impl Iterator<Item = &FittedSVMDataPoint<D>>
Returns an iterator over the support vectors and their corresponding alpha values.
Sourcepub fn num_support_vectors(&self) -> usize
pub fn num_support_vectors(&self) -> usize
Returns the number of support vectors.
Support vectors are data points with non-zero alpha values.
Trait Implementations§
impl<const D: usize, K> StructuralPartialEq for BinarySVM<D, K>where
K: Kernel<D>,
Auto Trait Implementations§
impl<const D: usize, K> Freeze for BinarySVM<D, K>where
K: Freeze,
impl<const D: usize, K> RefUnwindSafe for BinarySVM<D, K>where
K: RefUnwindSafe,
impl<const D: usize, K> Send for BinarySVM<D, K>where
K: Send,
impl<const D: usize, K> Sync for BinarySVM<D, K>where
K: Sync,
impl<const D: usize, K> Unpin for BinarySVM<D, K>where
K: Unpin,
impl<const D: usize, K> UnwindSafe for BinarySVM<D, K>where
K: UnwindSafe,
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.