pub struct DenseSVM { /* private fields */ }
Expand description
A SVM using SIMD intrinsics optimized for speed.
Creating a SVM
This SVM can be created by passing a ModelFile
into try_from
, or a &str
:
use ffsvm::*;
use std::convert::TryFrom;
let svm = DenseSVM::try_from("...");
Implementations§
source§impl DenseSVM
impl DenseSVM
sourcepub fn class_index_for_label(&self, label: i32) -> Option<usize>
pub fn class_index_for_label(&self, label: i32) -> Option<usize>
Finds the class index for a given label.
Description
This method takes a label
as defined in the libSVM training model
and returns the internal index
where this label resides. The index
equals Problem::probabilities
index where that label’s
probability can be found.
Returns
If the label was found its index returned in the Option
. Otherwise None
is returned.
sourcepub fn class_label_for_index(&self, index: usize) -> Option<i32>
pub fn class_label_for_index(&self, index: usize) -> Option<i32>
Returns the class label for a given index.
Description
The inverse of DenseSVM::class_index_for_label
, this function returns the class label
associated with a certain internal index. The index equals the Problem::probabilities
index where a label’s probability can be found.
Returns
If the index was found it is returned in the Option
. Otherwise None
is returned.
sourcepub const fn attributes(&self) -> usize
pub const fn attributes(&self) -> usize
Returns number of attributes, reflecting the libSVM model.