Trait opencv::ml::SVMConst

source ·
pub trait SVMConst: StatModelConst {
Show 14 methods // Required method fn as_raw_SVM(&self) -> *const c_void; // Provided methods 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

Constant methods for crate::ml::SVM

Required Methods§

Provided Methods§

source

fn get_type(&self) -> Result<i32>

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

See also

setType

source

fn get_gamma(&self) -> Result<f64>

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

See also

setGamma

source

fn get_coef0(&self) -> Result<f64>

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

See also

setCoef0

source

fn get_degree(&self) -> Result<f64>

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

See also

setDegree

source

fn get_c(&self) -> Result<f64>

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

source

fn get_nu(&self) -> Result<f64>

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

source

fn get_p(&self) -> Result<f64>

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

See also

setP

source

fn get_class_weights(&self) -> Result<Mat>

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

source

fn get_term_criteria(&self) -> Result<TermCriteria>

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

source

fn get_kernel_type(&self) -> Result<i32>

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

source

fn get_support_vectors(&self) -> Result<Mat>

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.

source

fn get_uncompressed_support_vectors(&self) -> Result<Mat>

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.

source

fn get_decision_function( &self, i: i32, alpha: &mut dyn ToOutputArray, svidx: &mut dyn ToOutputArray ) -> Result<f64>

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§

source§

impl SVMConst for Ptr<dyn SVM>