[][src]Struct ffsvm::SparseSVM

pub struct SparseSVM { /* fields omitted */ }

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.

impl<'a, 'b> TryFrom<&'a ModelFile<'b>> for SparseSVM[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl !Send for SparseSVM

impl Sync for SparseSVM

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> Cast for T where
    U: FromCast<T>, 
[src]

impl<T> FromCast for T[src]