pub struct Problem<V32> { /* private fields */ }
Expand description
A single problem a SVM should classify.
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(())
}
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.
After a Problem
has been classified, this will hold the SVMs solution.
Returns the probability estimates. Only really useful if the model was trained with probability estimates and you classified with them.
Returns the features. You must set them first and classifiy the problem before you can get a solution.
Clears the Problem when reusing it between calls. Only needed for SparseSVM problems.
Performs copy-assignment from
source
.
Read more
Formats the value using the given formatter.
Read more
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.