trainEM method

(bool, Mat, Mat, Mat) trainEM(
  1. Mat samples
)

Estimates the Gaussian mixture parameters from samples, starting with the Expectation step from initial values computed by k-means.

Returns whether training succeeded, the likelihood logarithm of each sample, the most probable mixture component of each sample and the posterior probabilities.

Implementation

(bool, Mat logLikelihoods, Mat labels, Mat probs) trainEM(Mat samples) => _train(
  (l, lb, pr, p) => cml.cv_ml_EM_trainEM(ref, samples.ref, l, lb, pr, p, ffi.nullptr),
);