pub struct Svm<F: Float, T> {
pub alpha: Vec<F>,
pub rho: F,
/* private fields */
}
Expand description
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§
source§impl<F: Float, T> Svm<F, T>
impl<F: Float, T> Svm<F, T>
sourcepub fn nsupport(&self) -> usize
pub fn nsupport(&self) -> usize
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.
sourcepub fn weighted_sum<D: Data<Elem = F>>(&self, sample: &ArrayBase<D, Ix1>) -> F
pub fn weighted_sum<D: Data<Elem = F>>(&self, sample: &ArrayBase<D, Ix1>) -> F
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§
source§impl<'a, F: Float, T> Display for Svm<F, T>
impl<'a, F: Float, T> Display for Svm<F, T>
Display solution
In order to understand the solution of the SMO solver the objective, number of iterations and required support vectors are printed here.
source§impl<F: PartialEq + Float, T: PartialEq> PartialEq for Svm<F, T>
impl<F: PartialEq + Float, T: PartialEq> PartialEq for Svm<F, T>
source§impl<F: Float, D: Data<Elem = F>> Predict<ArrayBase<D, Dim<[usize; 1]>>, Pr> for Svm<F, Pr>
impl<F: Float, D: Data<Elem = F>> Predict<ArrayBase<D, Dim<[usize; 1]>>, Pr> for Svm<F, Pr>
Predict a probability with a feature vector
source§impl<'a, F: Float, D: Data<Elem = F>> Predict<ArrayBase<D, Dim<[usize; 1]>>, bool> for Svm<F, bool>
impl<'a, F: Float, D: Data<Elem = F>> Predict<ArrayBase<D, Dim<[usize; 1]>>, bool> for Svm<F, bool>
Predict a probability with a feature vector
source§impl Predict<ArrayBase<OwnedRepr<f32>, Dim<[usize; 1]>>, f32> for Svm<f32, f32>
impl Predict<ArrayBase<OwnedRepr<f32>, Dim<[usize; 1]>>, f32> for Svm<f32, f32>
Predict a probability with a feature vector
source§impl Predict<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>, f64> for Svm<f64, f64>
impl Predict<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>, f64> for Svm<f64, f64>
Predict a probability with a feature vector
source§impl<'a> Predict<ArrayBase<ViewRepr<&'a f32>, Dim<[usize; 1]>>, f32> for Svm<f32, f32>
impl<'a> Predict<ArrayBase<ViewRepr<&'a f32>, Dim<[usize; 1]>>, f32> for Svm<f32, f32>
Predict a probability with a feature vector
source§impl<'a> Predict<ArrayBase<ViewRepr<&'a f64>, Dim<[usize; 1]>>, f64> for Svm<f64, f64>
impl<'a> Predict<ArrayBase<ViewRepr<&'a f64>, Dim<[usize; 1]>>, f64> for Svm<f64, f64>
Predict a probability with a feature vector
source§impl<F: Float, D: Data<Elem = F>> PredictInplace<ArrayBase<D, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<Pr>, Dim<[usize; 1]>>> for Svm<F, Pr>
impl<F: Float, D: Data<Elem = F>> PredictInplace<ArrayBase<D, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<Pr>, Dim<[usize; 1]>>> for Svm<F, Pr>
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.
source§impl<F: Float, D: Data<Elem = F>> PredictInplace<ArrayBase<D, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<bool>, Dim<[usize; 1]>>> for Svm<F, bool>
impl<F: Float, D: Data<Elem = F>> PredictInplace<ArrayBase<D, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<bool>, Dim<[usize; 1]>>> for Svm<F, bool>
Classify observations
This function takes a number of features and predicts target probabilities that they belong to the positive class.
source§impl<D: Data<Elem = f32>> PredictInplace<ArrayBase<D, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<f32>, Dim<[usize; 1]>>> for Svm<f32, f32>
impl<D: Data<Elem = f32>> PredictInplace<ArrayBase<D, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<f32>, Dim<[usize; 1]>>> for Svm<f32, f32>
Classify observations
This function takes a number of features and predicts target probabilities that they belong to the positive class.
source§impl<D: Data<Elem = f64>> PredictInplace<ArrayBase<D, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for Svm<f64, f64>
impl<D: Data<Elem = f64>> PredictInplace<ArrayBase<D, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for Svm<f64, f64>
Classify observations
This function takes a number of features and predicts target probabilities that they belong to the positive class.