[][src]Struct ffsvm::Problem

pub struct Problem<V32> { /* fields omitted */ }

A single problem a SVM should classify.

Creating a Problem

Problems are created via the Problem::from method and match the SVM type they were created for:

use ffsvm::*;
use std::convert::TryFrom;

fn main() -> Result<(), Error> {
    let svm = DenseSVM::try_from(SAMPLE_MODEL)?;

    let mut problem = Problem::from(&svm);

    Ok(())
}

Setting Features

A Problem is an instance of the SVM's problem domain. Before it can be classified, all features need to be set, for example by:

use ffsvm::*;

fn set_features(problem: &mut DenseProblem) {
    let features = problem.features();
    features[0] = -0.221184;
    features[3] = 0.135713;
}

It can then be classified via the Predict trait.

Methods

impl<T> Problem<T>[src]

pub fn solution(&self) -> Solution[src]

After a Problem has been classified, this will hold the SVMs solution.

pub fn probabilities(&self) -> &[f64][src]

Returns the probability estimates. Only really useful if the model was trained with probability estimates and you classified with them.

pub fn features(&mut self) -> &mut Features<T>[src]

Returns the features. You must set them first and classifiy the problem before you can get a solution.

Trait Implementations

impl<V32: Clone> Clone for Problem<V32>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<V32: Debug> Debug for Problem<V32>[src]

Auto Trait Implementations

impl<V32> Send for Problem<V32> where
    V32: Send

impl<V32> Sync for Problem<V32> where
    V32: Sync

Blanket Implementations

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

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]