Trait opencv::ml::prelude::SVMConst[][src]

pub trait SVMConst: StatModelConst {
Show 14 methods fn as_raw_SVM(&self) -> *const c_void; fn get_type(&self) -> Result<i32> { ... }
fn get_gamma(&self) -> Result<f64> { ... }
fn get_coef0(&self) -> Result<f64> { ... }
fn get_degree(&self) -> Result<f64> { ... }
fn get_c(&self) -> Result<f64> { ... }
fn get_nu(&self) -> Result<f64> { ... }
fn get_p(&self) -> Result<f64> { ... }
fn get_class_weights(&self) -> Result<Mat> { ... }
fn get_term_criteria(&self) -> Result<TermCriteria> { ... }
fn get_kernel_type(&self) -> Result<i32> { ... }
fn get_support_vectors(&self) -> Result<Mat> { ... }
fn get_uncompressed_support_vectors(&self) -> Result<Mat> { ... }
fn get_decision_function(
        &self,
        i: i32,
        alpha: &mut dyn ToOutputArray,
        svidx: &mut dyn ToOutputArray
    ) -> Result<f64> { ... }
}
Expand description

Support Vector Machines.

See also

@ref ml_intro_svm

Required methods

Provided methods

Type of a %SVM formulation. See SVM::Types. Default value is SVM::C_SVC.

See also

setType

Parameter inline formula of a kernel function. For SVM::POLY, SVM::RBF, SVM::SIGMOID or SVM::CHI2. Default value is 1.

See also

setGamma

Parameter coef0 of a kernel function. For SVM::POLY or SVM::SIGMOID. Default value is 0.

See also

setCoef0

Parameter degree of a kernel function. For SVM::POLY. Default value is 0.

See also

setDegree

Parameter C of a %SVM optimization problem. For SVM::C_SVC, SVM::EPS_SVR or SVM::NU_SVR. Default value is 0.

See also

setC

Parameter inline formula of a %SVM optimization problem. For SVM::NU_SVC, SVM::ONE_CLASS or SVM::NU_SVR. Default value is 0.

See also

setNu

Parameter inline formula of a %SVM optimization problem. For SVM::EPS_SVR. Default value is 0.

See also

setP

Optional weights in the SVM::C_SVC problem, assigned to particular classes. They are multiplied by C so the parameter C of class i becomes classWeights(i) * C. Thus these weights affect the misclassification penalty for different classes. The larger weight, the larger penalty on misclassification of data from the corresponding class. Default value is empty Mat.

See also

setClassWeights

Termination criteria of the iterative %SVM training procedure which solves a partial case of constrained quadratic optimization problem. You can specify tolerance and/or the maximum number of iterations. Default value is TermCriteria( TermCriteria::MAX_ITER + TermCriteria::EPS, 1000, FLT_EPSILON );

See also

setTermCriteria

Type of a %SVM kernel. See SVM::KernelTypes. Default value is SVM::RBF.

Retrieves all the support vectors

The method returns all the support vectors as a floating-point matrix, where support vectors are stored as matrix rows.

Retrieves all the uncompressed support vectors of a linear %SVM

The method returns all the uncompressed support vectors of a linear %SVM that the compressed support vector, used for prediction, was derived from. They are returned in a floating-point matrix, where the support vectors are stored as matrix rows.

Retrieves the decision function

Parameters

  • i: the index of the decision function. If the problem solved is regression, 1-class or 2-class classification, then there will be just one decision function and the index should always be 0. Otherwise, in the case of N-class classification, there will be inline formula decision functions.
  • alpha: the optional output vector for weights, corresponding to different support vectors. In the case of linear %SVM all the alpha’s will be 1’s.
  • svidx: the optional output vector of indices of support vectors within the matrix of support vectors (which can be retrieved by SVM::getSupportVectors). In the case of linear %SVM each decision function consists of a single “compressed” support vector.

The method returns rho parameter of the decision function, a scalar subtracted from the weighted sum of kernel responses.

Implementors