Struct ffsvm::DenseSVM

source ·
pub struct DenseSVM { /* private fields */ }
Expand description

A SVM using SIMD intrinsics optimized for speed.

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 = DenseSVM::try_from("...");

Implementations§

source§

impl DenseSVM

source

pub fn class_index_for_label(&self, label: i32) -> Option<usize>

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.

source

pub fn class_label_for_index(&self, index: usize) -> Option<i32>

Returns the class label for a given index.

Description

The inverse of DenseSVM::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.

source

pub const fn attributes(&self) -> usize

Returns number of attributes, reflecting the libSVM model.

source

pub fn classes(&self) -> usize

Returns number of classes, reflecting the libSVM model.

Trait Implementations§

source§

impl<'a> From<&'a DenseSVM> for DenseProblem

source§

fn from(svm: &DenseSVM) -> Self

Converts to this type from the input type.
source§

impl Predict<VectorD<Simd<f32, 8>>, VectorD<Simd<f64, 4>>> for DenseSVM

source§

fn predict_probability( &self, problem: &mut Problem<VectorD<f32s>> ) -> Result<(), Error>

Predict a probability value for a problem. Read more
source§

fn predict_value( &self, problem: &mut Problem<VectorD<f32s>> ) -> Result<(), Error>

Predict a single value for a Problem. Read more
source§

impl<'a, 'b> TryFrom<&'a ModelFile<'b>> for DenseSVM

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(raw_model: &'a ModelFile<'_>) -> Result<Self, Error>

Performs the conversion.
source§

impl<'a, 'b> TryFrom<&'a str> for DenseSVM

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(input: &'a str) -> Result<Self, Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.