Struct linfa_svm::Svm[][src]

pub struct Svm<F: Float, T> {
    pub alpha: Vec<F>,
    pub rho: F,
    // some fields omitted
}

Fitted Support Vector Machines model

This is the result of the SMO optimizer and contains the support vectors, quality of solution and optionally the linear hyperplane.

Fields

alpha: Vec<F>rho: F

Implementations

impl<F: Float, T> Svm<F, T>[src]

pub fn params() -> SvmParams<F, T>[src]

Create hyper parameter set

This creates a SvmParams and sets it to the default values:

  • C values of (1, 1)
  • Eps of 1e-7
  • No shrinking
  • Linear kernel

pub fn nsupport(&self) -> usize[src]

Returns the number of support vectors

This function returns the number of support vectors which have an influence on the decision outcome greater than zero.

pub fn weighted_sum<D: Data<Elem = F>>(&self, sample: &ArrayBase<D, Ix1>) -> F[src]

Sums the inner product of sample and every one of the support vectors.

Parameters

  • sample: the input sample

Returns

The sum of all inner products of sample and every one of the support vectors, scaled by their weight.

Panics

If the shape of sample is not compatible with the shape of the support vectors

Trait Implementations

impl<'a, F: Float, T> Display for Svm<F, T>[src]

Display solution

In order to understand the solution of the SMO solver the objective, number of iterations and required support vectors are printed here.

impl<F: Float, D: Data<Elem = F>> Predict<ArrayBase<D, Dim<[usize; 1]>>, Pr> for Svm<F, Pr>[src]

Predict a probability with a feature vector

impl<'a, F: Float, D: Data<Elem = F>> Predict<ArrayBase<D, Dim<[usize; 1]>>, bool> for Svm<F, bool>[src]

Predict a probability with a feature vector

impl Predict<ArrayBase<OwnedRepr<f32>, Dim<[usize; 1]>>, f32> for Svm<f32, f32>[src]

Predict a probability with a feature vector

impl Predict<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>, f64> for Svm<f64, f64>[src]

Predict a probability with a feature vector

impl<'a> Predict<ArrayBase<ViewRepr<&'a f32>, Dim<[usize; 1]>>, f32> for Svm<f32, f32>[src]

Predict a probability with a feature vector

impl<'a> Predict<ArrayBase<ViewRepr<&'a f64>, Dim<[usize; 1]>>, f64> for Svm<f64, f64>[src]

Predict a probability with a feature vector

impl<F: Float, D: Data<Elem = F>> PredictRef<ArrayBase<D, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<Pr>, Dim<[usize; 1]>>> for Svm<F, Pr>[src]

Predict a probability with a feature vector Classify observations

This function takes a number of features and predicts target probabilities that they belong to the positive class.

impl<F: Float, D: Data<Elem = F>> PredictRef<ArrayBase<D, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<bool>, Dim<[usize; 1]>>> for Svm<F, bool>[src]

Classify observations

This function takes a number of features and predicts target probabilities that they belong to the positive class.

impl<D: Data<Elem = f32>> PredictRef<ArrayBase<D, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<f32>, Dim<[usize; 1]>>> for Svm<f32, f32>[src]

Classify observations

This function takes a number of features and predicts target probabilities that they belong to the positive class.

impl<D: Data<Elem = f64>> PredictRef<ArrayBase<D, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for Svm<f64, f64>[src]

Classify observations

This function takes a number of features and predicts target probabilities that they belong to the positive class.

Auto Trait Implementations

impl<F, T> RefUnwindSafe for Svm<F, T> where
    F: RefUnwindSafe,
    T: RefUnwindSafe

impl<F, T> Send for Svm<F, T> where
    T: Send

impl<F, T> Sync for Svm<F, T> where
    T: Sync

impl<F, T> Unpin for Svm<F, T> where
    F: Unpin,
    T: Unpin

impl<F, T> UnwindSafe for Svm<F, T> where
    F: RefUnwindSafe + UnwindSafe,
    T: UnwindSafe

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<'a, F, D, T, O> Predict<&'a ArrayBase<D, Dim<[usize; 2]>>, T> for O where
    F: Float,
    D: Data<Elem = F>,
    O: PredictRef<ArrayBase<D, Dim<[usize; 2]>>, T>, 
[src]

impl<'a, F, R, T, S, O> Predict<&'a DatasetBase<R, T>, S> for O where
    F: Float,
    O: PredictRef<R, S>,
    R: Records<Elem = F>, 
[src]

impl<F, D, T, O> Predict<ArrayBase<D, Dim<[usize; 2]>>, DatasetBase<ArrayBase<D, Dim<[usize; 2]>>, T>> for O where
    F: Float,
    D: Data<Elem = F>,
    O: PredictRef<ArrayBase<D, Dim<[usize; 2]>>, T>, 
[src]

impl<F, R, T, S, O> Predict<DatasetBase<R, T>, DatasetBase<R, S>> for O where
    F: Float,
    O: PredictRef<R, S>,
    R: Records<Elem = F>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> 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<V, T> VZip<V> for T where
    V: MultiLane<T>,