OpenCV for Unity 2.6.4
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.10.0/index.html ) for the details of the argument of the method.
|
The class implements the Expectation Maximization algorithm. More...
Public Member Functions | |
int | getClustersNumber () |
int | getCovarianceMatrixType () |
void | getCovs (List< Mat > covs) |
Returns covariation matrices. | |
Mat | getMeans () |
Returns the cluster centers (means of the Gaussian mixture) | |
TermCriteria | getTermCriteria () |
double double double epsilon | getTermCriteriaAsValueTuple () |
Vec3d | getTermCriteriaAsVec3d () |
Mat | getWeights () |
Returns weights of the mixtures. | |
override float | predict (Mat samples) |
Returns posterior probabilities for the provided samples. | |
override float | predict (Mat samples, Mat results) |
Returns posterior probabilities for the provided samples. | |
override float | predict (Mat samples, Mat results, int flags) |
Returns posterior probabilities for the provided samples. | |
double[] | predict2 (Mat sample, Mat probs) |
Returns a likelihood logarithm value and an index of the most probable mixture component for the given sample. | |
void | setClustersNumber (int val) |
void | setCovarianceMatrixType (int val) |
void | setTermCriteria (in Vec3d val) |
void | setTermCriteria (in(double type, double maxCount, double epsilon) val) |
void | setTermCriteria (TermCriteria val) |
bool | trainE (Mat samples, Mat means0) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainE (Mat samples, Mat means0, Mat covs0) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainE (Mat samples, Mat means0, Mat covs0, Mat weights0) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainE (Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainE (Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods, Mat labels) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainE (Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods, Mat labels, Mat probs) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainEM (Mat samples) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainEM (Mat samples, Mat logLikelihoods) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainEM (Mat samples, Mat logLikelihoods, Mat labels) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainEM (Mat samples, Mat logLikelihoods, Mat labels, Mat probs) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainM (Mat samples, Mat probs0) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainM (Mat samples, Mat probs0, Mat logLikelihoods) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainM (Mat samples, Mat probs0, Mat logLikelihoods, Mat labels) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainM (Mat samples, Mat probs0, Mat logLikelihoods, Mat labels, Mat probs) |
Estimate the Gaussian mixture parameters from a samples set. | |
Public Member Functions inherited from OpenCVForUnity.MlModule.StatModel | |
float | calcError (TrainData data, bool test, Mat resp) |
Computes error on the training or test dataset. | |
override bool | empty () |
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. | |
int | getVarCount () |
Returns the number of variables in training samples. | |
bool | isClassifier () |
Returns true if the model is classifier. | |
bool | isTrained () |
Returns true if the model is trained. | |
bool | train (Mat samples, int layout, Mat responses) |
Trains the statistical model. | |
bool | train (TrainData trainData) |
Trains the statistical model. | |
bool | train (TrainData trainData, int flags) |
Trains the statistical model. | |
Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm | |
virtual void | clear () |
Clears the algorithm state. | |
virtual string | getDefaultName () |
IntPtr | getNativeObjAddr () |
void | save (string filename) |
Public Member Functions inherited from OpenCVForUnity.DisposableObject | |
void | Dispose () |
void | ThrowIfDisposed () |
Static Public Member Functions | |
static new EM | __fromPtr__ (IntPtr addr) |
static EM | create () |
static EM | load (string filepath) |
Loads and creates a serialized EM from a file. | |
static EM | load (string filepath, string nodeName) |
Loads and creates a serialized EM from a file. | |
Static Public Member Functions inherited from OpenCVForUnity.MlModule.StatModel | |
static new StatModel | __fromPtr__ (IntPtr addr) |
Static Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm | |
static Algorithm | __fromPtr__ (IntPtr addr) |
Static Public Member Functions inherited from OpenCVForUnity.DisposableObject | |
static IntPtr | ThrowIfNullIntPtr (IntPtr ptr) |
Public Attributes | |
double double | maxCount |
double | type |
Static Public Attributes | |
const int | COV_MAT_DEFAULT = COV_MAT_DIAGONAL |
const int | COV_MAT_DIAGONAL = 1 |
const int | COV_MAT_GENERIC = 2 |
const int | COV_MAT_SPHERICAL = 0 |
const int | DEFAULT_MAX_ITERS = 100 |
const int | DEFAULT_NCLUSTERS = 5 |
const int | START_AUTO_STEP = 0 |
const int | START_E_STEP = 1 |
const int | START_M_STEP = 2 |
Static Public Attributes inherited from OpenCVForUnity.MlModule.StatModel | |
const int | COMPRESSED_INPUT = 2 |
const int | PREPROCESSED_INPUT = 4 |
const int | RAW_OUTPUT = 1 |
const int | UPDATE_MODEL = 1 |
Protected Member Functions | |
override void | Dispose (bool disposing) |
Protected Member Functions inherited from OpenCVForUnity.MlModule.StatModel | |
override void | Dispose (bool disposing) |
Protected Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm | |
Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject | |
DisposableOpenCVObject () | |
DisposableOpenCVObject (bool isEnabledDispose) | |
DisposableOpenCVObject (IntPtr ptr) | |
DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose) | |
Protected Member Functions inherited from OpenCVForUnity.DisposableObject | |
DisposableObject () | |
DisposableObject (bool isEnabledDispose) | |
Additional Inherited Members | |
Package Functions inherited from OpenCVForUnity.MlModule.StatModel | |
Package Functions inherited from OpenCVForUnity.CoreModule.Algorithm | |
Package Attributes inherited from OpenCVForUnity.DisposableOpenCVObject | |
Properties inherited from OpenCVForUnity.DisposableObject | |
bool | IsDisposed [get, protected set] |
bool | IsEnabledDispose [get, set] |
The class implements the Expectation Maximization algorithm.
|
static |
|
static |
|
protectedvirtual |
Reimplemented from OpenCVForUnity.CoreModule.Algorithm.
int OpenCVForUnity.MlModule.EM.getClustersNumber | ( | ) |
int OpenCVForUnity.MlModule.EM.getCovarianceMatrixType | ( | ) |
void OpenCVForUnity.MlModule.EM.getCovs | ( | List< Mat > | covs | ) |
Returns covariation matrices.
Returns vector of covariation matrices. Number of matrices is the number of gaussian mixtures, each matrix is a square floating-point matrix NxN, where N is the space dimensionality.
Mat OpenCVForUnity.MlModule.EM.getMeans | ( | ) |
Returns the cluster centers (means of the Gaussian mixture)
Returns matrix with the number of rows equal to the number of mixtures and number of columns equal to the space dimensionality.
TermCriteria OpenCVForUnity.MlModule.EM.getTermCriteria | ( | ) |
double double double epsilon OpenCVForUnity.MlModule.EM.getTermCriteriaAsValueTuple | ( | ) |
Vec3d OpenCVForUnity.MlModule.EM.getTermCriteriaAsVec3d | ( | ) |
Mat OpenCVForUnity.MlModule.EM.getWeights | ( | ) |
Returns weights of the mixtures.
Returns vector with the number of elements equal to the number of mixtures.
|
static |
Loads and creates a serialized EM from a file.
Use EM.save to serialize and store an EM to disk. Load the EM from this file again, by calling this function with the path to the file. Optionally specify the node for the file containing the classifier
filepath | path to serialized EM |
nodeName | name of node containing the classifier |
|
static |
Loads and creates a serialized EM from a file.
Use EM.save to serialize and store an EM to disk. Load the EM from this file again, by calling this function with the path to the file. Optionally specify the node for the file containing the classifier
filepath | path to serialized EM |
nodeName | name of node containing the classifier |
|
virtual |
Returns posterior probabilities for the provided samples.
samples | The input samples, floating-point matrix |
results | The optional output \( nSamples \times nClusters\) matrix of results. It contains posterior probabilities for each sample from the input |
flags | This parameter will be ignored |
Reimplemented from OpenCVForUnity.MlModule.StatModel.
Returns posterior probabilities for the provided samples.
samples | The input samples, floating-point matrix |
results | The optional output \( nSamples \times nClusters\) matrix of results. It contains posterior probabilities for each sample from the input |
flags | This parameter will be ignored |
Reimplemented from OpenCVForUnity.MlModule.StatModel.
Returns posterior probabilities for the provided samples.
samples | The input samples, floating-point matrix |
results | The optional output \( nSamples \times nClusters\) matrix of results. It contains posterior probabilities for each sample from the input |
flags | This parameter will be ignored |
Reimplemented from OpenCVForUnity.MlModule.StatModel.
Returns a likelihood logarithm value and an index of the most probable mixture component for the given sample.
sample | A sample for classification. It should be a one-channel matrix of \(1 \times dims\) or \(dims \times 1\) size. |
probs | Optional output matrix that contains posterior probabilities of each component given the sample. It has \(1 \times nclusters\) size and CV_64FC1 type. |
The method returns a two-element double vector. Zero element is a likelihood logarithm value for the sample. First element is an index of the most probable mixture component for the given sample.
void OpenCVForUnity.MlModule.EM.setClustersNumber | ( | int | val | ) |
void OpenCVForUnity.MlModule.EM.setCovarianceMatrixType | ( | int | val | ) |
void OpenCVForUnity.MlModule.EM.setTermCriteria | ( | in Vec3d | val | ) |
void OpenCVForUnity.MlModule.EM.setTermCriteria | ( | in(double type, double maxCount, double epsilon) | val | ) |
void OpenCVForUnity.MlModule.EM.setTermCriteria | ( | TermCriteria | val | ) |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Expectation step. You need to provide initial means \(a_k\) of mixture components. Optionally you can pass initial weights \(\pi_k\) and covariance matrices \(S_k\) of mixture components.
samples | Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
means0 | Initial means \(a_k\) of mixture components. It is a one-channel matrix of \(nclusters \times dims\) size. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
covs0 | The vector of initial covariance matrices \(S_k\) of mixture components. Each of covariance matrices is a one-channel matrix of \(dims \times dims\) size. If the matrices do not have CV_64F type they will be converted to the inner matrices of such type for the further computing. |
weights0 | Initial weights \(\pi_k\) of mixture components. It should be a one-channel floating-point matrix with \(1 \times nclusters\) or \(nclusters \times 1\) size. |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. |
labels | The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type. |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Expectation step. You need to provide initial means \(a_k\) of mixture components. Optionally you can pass initial weights \(\pi_k\) and covariance matrices \(S_k\) of mixture components.
samples | Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
means0 | Initial means \(a_k\) of mixture components. It is a one-channel matrix of \(nclusters \times dims\) size. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
covs0 | The vector of initial covariance matrices \(S_k\) of mixture components. Each of covariance matrices is a one-channel matrix of \(dims \times dims\) size. If the matrices do not have CV_64F type they will be converted to the inner matrices of such type for the further computing. |
weights0 | Initial weights \(\pi_k\) of mixture components. It should be a one-channel floating-point matrix with \(1 \times nclusters\) or \(nclusters \times 1\) size. |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. |
labels | The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type. |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Expectation step. You need to provide initial means \(a_k\) of mixture components. Optionally you can pass initial weights \(\pi_k\) and covariance matrices \(S_k\) of mixture components.
samples | Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
means0 | Initial means \(a_k\) of mixture components. It is a one-channel matrix of \(nclusters \times dims\) size. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
covs0 | The vector of initial covariance matrices \(S_k\) of mixture components. Each of covariance matrices is a one-channel matrix of \(dims \times dims\) size. If the matrices do not have CV_64F type they will be converted to the inner matrices of such type for the further computing. |
weights0 | Initial weights \(\pi_k\) of mixture components. It should be a one-channel floating-point matrix with \(1 \times nclusters\) or \(nclusters \times 1\) size. |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. |
labels | The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type. |
bool OpenCVForUnity.MlModule.EM.trainE | ( | Mat | samples, |
Mat | means0, | ||
Mat | covs0, | ||
Mat | weights0, | ||
Mat | logLikelihoods ) |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Expectation step. You need to provide initial means \(a_k\) of mixture components. Optionally you can pass initial weights \(\pi_k\) and covariance matrices \(S_k\) of mixture components.
samples | Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
means0 | Initial means \(a_k\) of mixture components. It is a one-channel matrix of \(nclusters \times dims\) size. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
covs0 | The vector of initial covariance matrices \(S_k\) of mixture components. Each of covariance matrices is a one-channel matrix of \(dims \times dims\) size. If the matrices do not have CV_64F type they will be converted to the inner matrices of such type for the further computing. |
weights0 | Initial weights \(\pi_k\) of mixture components. It should be a one-channel floating-point matrix with \(1 \times nclusters\) or \(nclusters \times 1\) size. |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. |
labels | The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type. |
bool OpenCVForUnity.MlModule.EM.trainE | ( | Mat | samples, |
Mat | means0, | ||
Mat | covs0, | ||
Mat | weights0, | ||
Mat | logLikelihoods, | ||
Mat | labels ) |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Expectation step. You need to provide initial means \(a_k\) of mixture components. Optionally you can pass initial weights \(\pi_k\) and covariance matrices \(S_k\) of mixture components.
samples | Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
means0 | Initial means \(a_k\) of mixture components. It is a one-channel matrix of \(nclusters \times dims\) size. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
covs0 | The vector of initial covariance matrices \(S_k\) of mixture components. Each of covariance matrices is a one-channel matrix of \(dims \times dims\) size. If the matrices do not have CV_64F type they will be converted to the inner matrices of such type for the further computing. |
weights0 | Initial weights \(\pi_k\) of mixture components. It should be a one-channel floating-point matrix with \(1 \times nclusters\) or \(nclusters \times 1\) size. |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. |
labels | The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type. |
bool OpenCVForUnity.MlModule.EM.trainE | ( | Mat | samples, |
Mat | means0, | ||
Mat | covs0, | ||
Mat | weights0, | ||
Mat | logLikelihoods, | ||
Mat | labels, | ||
Mat | probs ) |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Expectation step. You need to provide initial means \(a_k\) of mixture components. Optionally you can pass initial weights \(\pi_k\) and covariance matrices \(S_k\) of mixture components.
samples | Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
means0 | Initial means \(a_k\) of mixture components. It is a one-channel matrix of \(nclusters \times dims\) size. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
covs0 | The vector of initial covariance matrices \(S_k\) of mixture components. Each of covariance matrices is a one-channel matrix of \(dims \times dims\) size. If the matrices do not have CV_64F type they will be converted to the inner matrices of such type for the further computing. |
weights0 | Initial weights \(\pi_k\) of mixture components. It should be a one-channel floating-point matrix with \(1 \times nclusters\) or \(nclusters \times 1\) size. |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. |
labels | The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type. |
bool OpenCVForUnity.MlModule.EM.trainEM | ( | Mat | samples | ) |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Expectation step. Initial values of the model parameters will be estimated by the k-means algorithm.
Unlike many of the ML models, EM is an unsupervised learning algorithm and it does not take responses (class labels or function values) as input. Instead, it computes the Maximum Likelihood Estimate of the Gaussian mixture parameters from an input sample set, stores all the parameters inside the structure: \(p_{i,k}\) in probs, \(a_k\) in means , \(S_k\) in covs[k], \(\pi_k\) in weights , and optionally computes the output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample).
The trained model can be used further for prediction, just like any other classifier. The trained model is similar to the NormalBayesClassifier.
samples | Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. |
labels | The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type. |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Expectation step. Initial values of the model parameters will be estimated by the k-means algorithm.
Unlike many of the ML models, EM is an unsupervised learning algorithm and it does not take responses (class labels or function values) as input. Instead, it computes the Maximum Likelihood Estimate of the Gaussian mixture parameters from an input sample set, stores all the parameters inside the structure: \(p_{i,k}\) in probs, \(a_k\) in means , \(S_k\) in covs[k], \(\pi_k\) in weights , and optionally computes the output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample).
The trained model can be used further for prediction, just like any other classifier. The trained model is similar to the NormalBayesClassifier.
samples | Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. |
labels | The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type. |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Expectation step. Initial values of the model parameters will be estimated by the k-means algorithm.
Unlike many of the ML models, EM is an unsupervised learning algorithm and it does not take responses (class labels or function values) as input. Instead, it computes the Maximum Likelihood Estimate of the Gaussian mixture parameters from an input sample set, stores all the parameters inside the structure: \(p_{i,k}\) in probs, \(a_k\) in means , \(S_k\) in covs[k], \(\pi_k\) in weights , and optionally computes the output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample).
The trained model can be used further for prediction, just like any other classifier. The trained model is similar to the NormalBayesClassifier.
samples | Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. |
labels | The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type. |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Expectation step. Initial values of the model parameters will be estimated by the k-means algorithm.
Unlike many of the ML models, EM is an unsupervised learning algorithm and it does not take responses (class labels or function values) as input. Instead, it computes the Maximum Likelihood Estimate of the Gaussian mixture parameters from an input sample set, stores all the parameters inside the structure: \(p_{i,k}\) in probs, \(a_k\) in means , \(S_k\) in covs[k], \(\pi_k\) in weights , and optionally computes the output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample).
The trained model can be used further for prediction, just like any other classifier. The trained model is similar to the NormalBayesClassifier.
samples | Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. |
labels | The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type. |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Maximization step. You need to provide initial probabilities \(p_{i,k}\) to use this option.
samples | Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
probs0 | the probabilities |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. |
labels | The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type. |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Maximization step. You need to provide initial probabilities \(p_{i,k}\) to use this option.
samples | Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
probs0 | the probabilities |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. |
labels | The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type. |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Maximization step. You need to provide initial probabilities \(p_{i,k}\) to use this option.
samples | Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
probs0 | the probabilities |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. |
labels | The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type. |
bool OpenCVForUnity.MlModule.EM.trainM | ( | Mat | samples, |
Mat | probs0, | ||
Mat | logLikelihoods, | ||
Mat | labels, | ||
Mat | probs ) |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Maximization step. You need to provide initial probabilities \(p_{i,k}\) to use this option.
samples | Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. |
probs0 | the probabilities |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. |
labels | The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type. |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
double double OpenCVForUnity.MlModule.EM.maxCount |
|
static |
|
static |
|
static |
double OpenCVForUnity.MlModule.EM.type |