[−][src]Struct ffsvm::Problem
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(&self) -> 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
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
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>,