NormalBayesClassifier class
Bayes classifier for normally distributed data. https://docs.opencv.org/4.x/d4/d8e/classcv_1_1ml_1_1NormalBayesClassifier.html
- Inheritance
- Available extensions
Constructors
- NormalBayesClassifier.create()
-
Creates an empty model. Use one of the train methods to train it, or NormalBayesClassifier.load.
factory
- NormalBayesClassifier.fromPointer(NormalBayesClassifierPtr ptr, [bool attach = true])
-
factory
- NormalBayesClassifier.load(String filepath)
-
Loads a model saved with save from
filepath. Throws CvException when the file does not hold a valid model.factory - NormalBayesClassifier.loadFromString(String strModel, {String objname = ''})
-
Loads a model from the content of a file saved with save (e.g. a Flutter asset).
factory
Properties
- defaultName → String
-
The name used when saving the model,
opencv_ml_nbayes.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- isClassifier → bool
-
Whether the model is a classifier (false for a regressor).
no setter
- isDisposed → bool
-
Whether this object has been disposed.
no setterinherited
- isEmpty → bool
-
no setter
- isTrained → bool
-
no setter
-
props
→ List<
Object?> -
no setterinherited
-
ptr
↔ Pointer<
NormalBayesClassifier> -
getter/setter pairinherited
- ref → NormalBayesClassifier
-
A view of the native memory behind ptr, not a copy.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- varCount → int
-
Number of variables in training samples.
no setter
Methods
-
calcError(
TrainData data, bool test) → (double, Mat) -
Computes the error on the training (
testfalse) or test (testtrue) part ofdata. -
calcErrorAsync(
TrainData data, bool test) → Future< (double, Mat)> -
Available on NormalBayesClassifier, provided by the NormalBayesClassifierAsync extension
-
clear(
) → void - Clears the model, it becomes untrained.
-
dispose(
) → void -
Releases the underlying native resources. Idempotent: calling it more
than once is safe, but the object must not be used after dispose.
inherited
-
freeNative(
) → void -
Frees the native resources owned by this object. Subclasses implement the
concrete free logic here; callers must use dispose instead.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
predict(
Mat samples, {int flags = 0}) → Mat -
Predicts the response for each row of
samples, one row of the returned Mat per sample. -
predictAsync(
Mat samples, {int flags = 0}) → Future< Mat> -
Available on NormalBayesClassifier, provided by the NormalBayesClassifierAsync extension
-
predictProb(
Mat inputs, {int flags = 0}) → (Mat, Mat) -
Predicts the response for each row of
inputsand the likelihood of each class. -
predictProbAsync(
Mat inputs, {int flags = 0}) → Future< (Mat, Mat)> -
Available on NormalBayesClassifier, provided by the NormalBayesClassifierAsync extension
-
save(
String filename) → void -
Saves the model to
filename(.xml, .yml or .json). -
toString(
) → String -
A string representation of this object.
inherited
-
train(
Mat samples, int layout, Mat responses) → bool -
Trains the model on
samples(CV_32F, one sample per row for ROW_SAMPLE). -
trainAsync(
Mat samples, int layout, Mat responses) → Future< bool> -
Available on NormalBayesClassifier, provided by the NormalBayesClassifierAsync extension
-
trainWithData(
TrainData data, {int flags = 0}) → bool -
Trains the model on
data,flagsmay be StatModel.UPDATE_MODEL or model-specific flags. -
trainWithDataAsync(
TrainData data, {int flags = 0}) → Future< bool> -
Available on NormalBayesClassifier, provided by the NormalBayesClassifierAsync extension
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- finalizer → NativeFinalizer
-
final