predict2 method

(double, int, Mat) predict2(
  1. Mat sample
)

Predicts the likelihood logarithm and the most probable mixture component of sample (a single row), and the posterior probability of each component.

Implementation

(double logLikelihood, int label, Mat probs) predict2(Mat sample) {
  final p = calloc<cvg.Vec2d>();
  final probs = Mat.empty();
  try {
    cvRun(() => cml.cv_ml_EM_predict2(ref, sample.ref, probs.ref, p, ffi.nullptr));
    return (p.ref.val1, p.ref.val2.round(), probs);
  } catch (_) {
    probs.dispose();
    rethrow;
  } finally {
    calloc.free(p);
  }
}