predictProb method
Predicts the response for each row of inputs and the likelihood of each class.
Returns the predicted labels and, per sample, the unnormalized likelihood of each class: the values are not probabilities (a row does not sum to 1, and they underflow to 0 far from the classes), but the largest one is the predicted class.
Implementation
(Mat outputs, Mat outputProbs) predictProb(Mat inputs, {int flags = 0}) {
final p = calloc<ffi.Float>();
final outputs = Mat.empty();
final outputProbs = Mat.empty();
try {
cvRun(
() => cml.cv_ml_NormalBayesClassifier_predictProb(
ref,
inputs.ref,
outputs.ref,
outputProbs.ref,
flags,
p,
ffi.nullptr,
),
);
return (outputs, outputProbs);
} catch (_) {
outputs.dispose();
outputProbs.dispose();
rethrow;
} finally {
calloc.free(p);
}
}