pub struct MultiClassSVM<const D: usize, K, C>{ /* private fields */ }Expand description
A fitted multi-class classification support vector machine using One-vs-One strategy.
§Type Parameters
D- The dimension or number of features.K- The type of the kernel function.C- The type of the class label.
§Strategy
Uses One-vs-One (OvO) approach: trains a binary classifier for each pair of classes. For N classes, trains N*(N-1)/2 binary classifiers. Prediction is done by majority voting.
Implementations§
Source§impl<const D: usize, K, C> MultiClassSVM<D, K, C>
impl<const D: usize, K, C> MultiClassSVM<D, K, C>
Sourcepub fn predict_with_votes(&self, x: &RowVector<D>) -> (C, Vec<(C, usize)>)
pub fn predict_with_votes(&self, x: &RowVector<D>) -> (C, Vec<(C, usize)>)
Sourcepub const fn num_classes(&self) -> usize
pub const fn num_classes(&self) -> usize
Returns the number of classes.
Sourcepub fn num_classifiers(&self) -> usize
pub fn num_classifiers(&self) -> usize
Returns the number of binary classifiers.
Trait Implementations§
Source§impl<const D: usize, K, C> Clone for MultiClassSVM<D, K, C>
impl<const D: usize, K, C> Clone for MultiClassSVM<D, K, C>
Source§fn clone(&self) -> MultiClassSVM<D, K, C>
fn clone(&self) -> MultiClassSVM<D, K, C>
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<const D: usize, K, C> Debug for MultiClassSVM<D, K, C>
impl<const D: usize, K, C> Debug for MultiClassSVM<D, K, C>
Source§impl<const D: usize, K, C> PartialEq for MultiClassSVM<D, K, C>
impl<const D: usize, K, C> PartialEq for MultiClassSVM<D, K, C>
impl<const D: usize, K, C> StructuralPartialEq for MultiClassSVM<D, K, C>
Auto Trait Implementations§
impl<const D: usize, K, C> Freeze for MultiClassSVM<D, K, C>
impl<const D: usize, K, C> RefUnwindSafe for MultiClassSVM<D, K, C>where
C: RefUnwindSafe,
K: RefUnwindSafe,
impl<const D: usize, K, C> Send for MultiClassSVM<D, K, C>
impl<const D: usize, K, C> Sync for MultiClassSVM<D, K, C>
impl<const D: usize, K, C> Unpin for MultiClassSVM<D, K, C>
impl<const D: usize, K, C> UnwindSafe for MultiClassSVM<D, K, C>where
C: UnwindSafe,
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.