[−][src]Struct ffsvm::SparseSVM
A SVM optimized for large models with many empty attributes.
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 = SparseSVM::try_from("...");
Methods
impl SparseSVM
[src]
pub fn class_index_for_label(&self, label: i32) -> Option<usize>
[src]
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.
pub fn class_label_for_index(&self, index: usize) -> Option<i32>
[src]
Returns the class label for a given index.
Description
The inverse of SparseSVM::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.
pub fn attributes(&self) -> usize
[src]
Returns number of attributes, reflecting the libSVM model.
pub fn classes(&self) -> usize
[src]
Returns number of classes, reflecting the libSVM model.
Trait Implementations
impl<'a> From<&'a SparseSVM> for SparseProblem
[src]
impl<'a, 'b> TryFrom<&'a str> for SparseSVM
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(input: &'a str) -> Result<SparseSVM, Error>
[src]
impl<'a, 'b> TryFrom<&'a ModelFile<'b>> for SparseSVM
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, U> Cast for T where
U: FromCast<T>,
[src]
U: FromCast<T>,