Expand description
§Machine Learning
The Machine Learning Library (MLL) is a set of classes and functions for statistical classification, regression, and clustering of data.
Most of the classification and regression algorithms are implemented as C++ classes. As the algorithms have different sets of features (like an ability to handle missing measurements or categorical input variables), there is a little common ground between the classes. This common ground is defined by the class cv::ml::StatModel that all the other ML classes are derived from.
See detailed overview here: [ml_intro].
Modules§
Structs§
- ANN_MLP
- Artificial Neural Networks - Multi-Layer Perceptrons.
- Boost
- Boosted tree classifier derived from DTrees
- DTrees
- The class represents a single decision tree or a collection of decision trees.
- DTrees_
Node - The class represents a decision tree node.
- DTrees_
Split - The class represents split in a decision tree.
- EM
- The class implements the Expectation Maximization algorithm.
- KNearest
- The class implements K-Nearest Neighbors model
- Logistic
Regression - Implements Logistic Regression classifier.
- Normal
Bayes Classifier - Bayes classifier for normally distributed data.
- Param
Grid - The structure represents the logarithmic grid range of statmodel parameters.
- RTrees
- The class implements the random forest predictor.
- SVM
- Support Vector Machines.
- SVMSGD
- ! Stochastic Gradient Descent SVM classifier
- SVM_
Kernel - Stat
Model - Base class for statistical models in OpenCV ML.
- Train
Data - Class encapsulating training data.
Enums§
- ANN_
MLP_ Activation Functions - possible activation functions
- ANN_
MLP_ Train Flags - Train options
- ANN_
MLP_ Training Methods - Available training methods
- Boost_
Types - Boosting type. Gentle AdaBoost and Real AdaBoost are often the preferable choices.
- DTrees_
Flags - Predict options
- EM_
Types - Type of covariation matrices
- Error
Types - %Error types
- KNearest_
Types - Implementations of KNearest algorithm
- Logistic
Regression_ Methods - Training methods
- Logistic
Regression_ RegKinds - Regularization kinds
- SVMSGD_
Margin Type - Margin type.
- SVMSGD_
Svmsgd Type - SVMSGD type. ASGD is often the preferable choice.
- SVM_
Kernel Types - %SVM kernel type
- SVM_
Param Types - %SVM params type
- SVM_
Types - %SVM type
- Sample
Types - Sample types
- Stat
Model_ Flags - Predict options
- Variable
Types - Variable types
Constants§
- ANN_
MLP_ ANNEAL - The simulated annealing algorithm. See Kirkpatrick83 for details.
- ANN_
MLP_ BACKPROP - The back-propagation algorithm.
- ANN_
MLP_ GAUSSIAN - Gaussian function: inline formula
- ANN_
MLP_ IDENTITY - Identity function: inline formula
- ANN_
MLP_ LEAKYRELU - Leaky ReLU function: for x>0 inline formula and x<=0 inline formula
- ANN_
MLP_ NO_ INPUT_ SCALE - Do not normalize the input vectors. If this flag is not set, the training algorithm normalizes each input feature independently, shifting its mean value to 0 and making the standard deviation equal to 1. If the network is assumed to be updated frequently, the new training data could be much different from original one. In this case, you should take care of proper normalization.
- ANN_
MLP_ NO_ OUTPUT_ SCALE - Do not normalize the output vectors. If the flag is not set, the training algorithm normalizes each output feature independently, by transforming it to the certain range depending on the used activation function.
- ANN_
MLP_ RELU - ReLU function: inline formula
- ANN_
MLP_ RPROP - The RPROP algorithm. See RPROP93 for details.
- ANN_
MLP_ SIGMOID_ SYM - Symmetrical sigmoid: inline formula
- ANN_
MLP_ UPDATE_ WEIGHTS - Update the network weights, rather than compute them from scratch. In the latter case the weights are initialized using the Nguyen-Widrow algorithm.
- Boost_
DISCRETE - Discrete AdaBoost.
- Boost_
GENTLE - Gentle AdaBoost. It puts less weight on outlier data points and for that reason is often good with regression data.
- Boost_
LOGIT - LogitBoost. It can produce good regression fits.
- Boost_
REAL - Real AdaBoost. It is a technique that utilizes confidence-rated predictions and works well with categorical data.
- COL_
SAMPLE - each training sample occupies a column of samples
- DTrees_
PREDICT_ AUTO - DTrees_
PREDICT_ MASK - DTrees_
PREDICT_ MAX_ VOTE - DTrees_
PREDICT_ SUM - EM_
COV_ MAT_ DEFAULT - A symmetric positively defined matrix. The number of free parameters in each matrix is about inline formula. It is not recommended to use this option, unless there is pretty accurate initial estimation of the parameters and/or a huge number of training samples.
- EM_
COV_ MAT_ DIAGONAL - A diagonal matrix with positive diagonal elements. The number of free parameters is d for each matrix. This is most commonly used option yielding good estimation results.
- EM_
COV_ MAT_ GENERIC - A symmetric positively defined matrix. The number of free parameters in each matrix is about inline formula. It is not recommended to use this option, unless there is pretty accurate initial estimation of the parameters and/or a huge number of training samples.
- EM_
COV_ MAT_ SPHERICAL - A scaled identity matrix inline formula. There is the only parameter inline formula to be estimated for each matrix. The option may be used in special cases, when the constraint is relevant, or as a first step in the optimization (for example in case when the data is preprocessed with PCA). The results of such preliminary estimation may be passed again to the optimization procedure, this time with covMatType=EM::COV_MAT_DIAGONAL.
- EM_
DEFAULT_ MAX_ ITERS - EM_
DEFAULT_ NCLUSTERS - EM_
START_ AUTO_ STEP - EM_
START_ E_ STEP - EM_
START_ M_ STEP - KNearest_
BRUTE_ FORCE - KNearest_
KDTREE - Logistic
Regression_ BATCH - Logistic
Regression_ MINI_ BATCH - Set MiniBatchSize to a positive integer when using this method.
- Logistic
Regression_ REG_ DISABLE - Regularization disabled
- Logistic
Regression_ REG_ L1 - %L1 norm
- Logistic
Regression_ REG_ L2 - %L2 norm
- ROW_
SAMPLE - each training sample is a row of samples
- SVMSGD_
ASGD - Average Stochastic Gradient Descent
- SVMSGD_
HARD_ MARGIN - More accurate for the case of linearly separable sets.
- SVMSGD_
SGD - Stochastic Gradient Descent
- SVMSGD_
SOFT_ MARGIN - General case, suits to the case of non-linearly separable sets, allows outliers.
- SVM_C
- SVM_
CHI2 - Exponential Chi2 kernel, similar to the RBF kernel: inline formula.
- SVM_
COEF - SVM_
CUSTOM - Returned by SVM::getKernelType in case when custom kernel has been set
- SVM_
C_ SVC - C-Support Vector Classification. n-class classification (n inline formula 2), allows imperfect separation of classes with penalty multiplier C for outliers.
- SVM_
DEGREE - SVM_
EPS_ SVR - inline formula-Support Vector Regression. The distance between feature vectors from the training set and the fitting hyper-plane must be less than p. For outliers the penalty multiplier C is used.
- SVM_
GAMMA - SVM_
INTER - Histogram intersection kernel. A fast kernel. inline formula.
- SVM_
LINEAR - Linear kernel. No mapping is done, linear discrimination (or regression) is done in the original feature space. It is the fastest option. inline formula.
- SVM_NU
- SVM_
NU_ SVC - inline formula-Support Vector Classification. n-class classification with possible imperfect separation. Parameter inline formula (in the range 0..1, the larger the value, the smoother the decision boundary) is used instead of C.
- SVM_
NU_ SVR - inline formula-Support Vector Regression. inline formula is used instead of p. See LibSVM for details.
- SVM_
ONE_ CLASS - Distribution Estimation (One-class %SVM). All the training data are from the same class, %SVM builds a boundary that separates the class from the rest of the feature space.
- SVM_P
- SVM_
POLY - Polynomial kernel: inline formula.
- SVM_RBF
- Radial basis function (RBF), a good choice in most cases. inline formula.
- SVM_
SIGMOID - Sigmoid kernel: inline formula.
- Stat
Model_ COMPRESSED_ INPUT - Stat
Model_ PREPROCESSED_ INPUT - Stat
Model_ RAW_ OUTPUT - makes the method return the raw results (the sum), not the class label
- Stat
Model_ UPDATE_ MODEL - TEST_
ERROR - TRAIN_
ERROR - VAR_
CATEGORICAL - categorical variables
- VAR_
NUMERICAL - same as VAR_ORDERED
- VAR_
ORDERED - ordered variables
Traits§
- ANN_
MLPTrait - Mutable methods for crate::ml::ANN_MLP
- ANN_
MLPTrait Const - Constant methods for crate::ml::ANN_MLP
- Boost
Trait - Mutable methods for crate::ml::Boost
- Boost
Trait Const - Constant methods for crate::ml::Boost
- DTrees
Trait - Mutable methods for crate::ml::DTrees
- DTrees
Trait Const - Constant methods for crate::ml::DTrees
- DTrees_
Node Trait - Mutable methods for crate::ml::DTrees_Node
- DTrees_
Node Trait Const - Constant methods for crate::ml::DTrees_Node
- DTrees_
Split Trait - Mutable methods for crate::ml::DTrees_Split
- DTrees_
Split Trait Const - Constant methods for crate::ml::DTrees_Split
- EMTrait
- Mutable methods for crate::ml::EM
- EMTrait
Const - Constant methods for crate::ml::EM
- KNearest
Trait - Mutable methods for crate::ml::KNearest
- KNearest
Trait Const - Constant methods for crate::ml::KNearest
- Logistic
Regression Trait - Mutable methods for crate::ml::LogisticRegression
- Logistic
Regression Trait Const - Constant methods for crate::ml::LogisticRegression
- Normal
Bayes Classifier Trait - Mutable methods for crate::ml::NormalBayesClassifier
- Normal
Bayes Classifier Trait Const - Constant methods for crate::ml::NormalBayesClassifier
- Param
Grid Trait - Mutable methods for crate::ml::ParamGrid
- Param
Grid Trait Const - Constant methods for crate::ml::ParamGrid
- RTrees
Trait - Mutable methods for crate::ml::RTrees
- RTrees
Trait Const - Constant methods for crate::ml::RTrees
- SVMSGD
Trait - Mutable methods for crate::ml::SVMSGD
- SVMSGD
Trait Const - Constant methods for crate::ml::SVMSGD
- SVMTrait
- Mutable methods for crate::ml::SVM
- SVMTrait
Const - Constant methods for crate::ml::SVM
- SVM_
Kernel Trait - Mutable methods for crate::ml::SVM_Kernel
- SVM_
Kernel Trait Const - Constant methods for crate::ml::SVM_Kernel
- Stat
Model Trait - Mutable methods for crate::ml::StatModel
- Stat
Model Trait Const - Constant methods for crate::ml::StatModel
- Train
Data Trait - Mutable methods for crate::ml::TrainData
- Train
Data Trait Const - Constant methods for crate::ml::TrainData
Functions§
- create_
concentric_ spheres_ test_ set - Creates test set
- rand_
mv_ normal - Generates sample from multivariate normal distribution