Machine Learning#

Detailed Description#

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.

Classes#

Name

Description

class cv::ml::ANN_MLP

Artificial Neural Networks - Multi-Layer Perceptrons. View details

class cv::ml::Boost

Boosted tree classifier derived from DTrees. View details

class cv::ml::DTrees

The class represents a single decision tree or a collection of decision trees. View details

class cv::ml::EM

The class implements the Expectation Maximization algorithm. View details

class cv::ml::KNearest

The class implements K-Nearest Neighbors model. View details

class cv::ml::LogisticRegression

Implements Logistic Regression classifier. View details

class cv::ml::NormalBayesClassifier

Bayes classifier for normally distributed data. View details

class cv::ml::ParamGrid

The structure represents the logarithmic grid range of statmodel parameters. View details

class cv::ml::RTrees

The class implements the random forest predictor. View details

struct cv::ml::SimulatedAnnealingSolverSystem

This class declares example interface for system state used in simulated annealing optimization algorithm. View details

class cv::ml::StatModel

Base class for statistical models in OpenCV ML. View details

class cv::ml::SVM

Support Vector Machines. View details

class cv::ml::SVMSGD

Stochastic Gradient Descent SVM classifier. View details

class cv::ml::TrainData

Class encapsulating training data. View details

Enumerations#

Error types View details

Sample types. View details

Variable types. View details

Typedef Documentation#

ANN_MLP_ANNEAL#

typedef ANN_MLP cv::ml::ANN_MLP_ANNEAL

#include <opencv2/ml.hpp>

Enumeration Type Documentation#

ErrorTypes#

enum cv::ml::ErrorTypes

#include <opencv2/ml.hpp>

Error types

Enumerator:

TEST_ERROR
Python: cv.ml.TEST_ERROR

TRAIN_ERROR
Python: cv.ml.TRAIN_ERROR

SampleTypes#

enum cv::ml::SampleTypes

#include <opencv2/ml.hpp>

Sample types.

Enumerator:

ROW_SAMPLE
Python: cv.ml.ROW_SAMPLE

each training sample is a row of samples

COL_SAMPLE
Python: cv.ml.COL_SAMPLE

each training sample occupies a column of samples

VariableTypes#

enum cv::ml::VariableTypes

#include <opencv2/ml.hpp>

Variable types.

Enumerator:

VAR_NUMERICAL
Python: cv.ml.VAR_NUMERICAL

same as VAR_ORDERED

VAR_ORDERED
Python: cv.ml.VAR_ORDERED

ordered variables

VAR_CATEGORICAL
Python: cv.ml.VAR_CATEGORICAL

categorical variables

Function Documentation#

createConcentricSpheresTestSet()#

void cv::ml::createConcentricSpheresTestSet(
int nsamples,
int nfeatures,
int nclasses,
OutputArray samples,
OutputArray responses )

#include <opencv2/ml.hpp>

Creates test set.

Here is the call graph for this function:

cv::ml::createConcentricSpheresTestSet Node1 cv::ml::createConcentric SpheresTestSet Node1->Node1

cv::ml::createConcentricSpheresTestSet Node1 cv::ml::createConcentric SpheresTestSet Node1->Node1

randMVNormal()#

void cv::ml::randMVNormal(
InputArray mean,
InputArray cov,
int nsamples,
OutputArray samples )

#include <opencv2/ml.hpp>

Generates sample from multivariate normal distribution.

Parameters

  • mean — an average row vector

  • cov — symmetric covariation matrix

  • nsamples — returned samples count

  • samples — returned samples array

Here is the call graph for this function:

cv::ml::randMVNormal Node1 cv::ml::randMVNormal Node1->Node1

cv::ml::randMVNormal Node1 cv::ml::randMVNormal Node1->Node1

simulatedAnnealingSolver()#

template<class SimulatedAnnealingSolverSystem>
int cv::ml::simulatedAnnealingSolver(
SimulatedAnnealingSolverSystem & solverSystem,
double initialTemperature,
double finalTemperature,
double coolingRatio,
size_t iterationsPerStep,
double * lastTemperature = NULL,
cv::RNG & rngEnergy = cv::theRNG() )

#include <opencv2/ml.hpp>

The class implements simulated annealing for optimization.

[166] for details

Parameters

  • solverSystem — optimization system (see SimulatedAnnealingSolverSystem)

  • initialTemperature — initial temperature

  • finalTemperature — final temperature

  • coolingRatio — temperature step multiplies

  • iterationsPerStep — number of iterations per temperature changing step

  • lastTemperature — optional output for last used temperature

  • rngEnergy — specify custom random numbers generator (cv::theRNG() by default)

Here is the call graph for this function:

cv::ml::simulatedAnnealingSolver Node1 cv::ml::simulatedAnnealing Solver Node1->Node1

cv::ml::simulatedAnnealingSolver Node1 cv::ml::simulatedAnnealing Solver Node1->Node1