Boost class

Boosted tree classifier derived from DTrees. https://docs.opencv.org/4.x/db/d7d/classcv_1_1ml_1_1Boost.html

Inheritance
Available extensions

Constructors

Boost.create()
Creates an empty model. Use one of the train methods to train it, or Boost.load.
factory
Boost.fromPointer(BoostPtr ptr, [bool attach = true])
factory
Boost.load(String filepath)
Loads a model saved with save from filepath. Throws CvException when the file does not hold a valid model.
factory
Boost.loadFromString(String strModel, {String objname = ''})
Loads a model from the content of a file saved with save (e.g. a Flutter asset).
factory

Properties

boostType ↔ int
Type of the boosting algorithm, one of DISCRETE, REAL, LOGIT, GENTLE.
getter/setter pair
cvFolds ↔ int
The number of cross-validation folds used to prune the tree. OpenCV 4.x does not implement the pruning: values > 1 throw and 1 is stored as 0 (no pruning).
getter/setter pair
defaultName → String
The name used when saving the model, opencv_ml_boost.
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
maxCategories ↔ int
Cluster possible values of a categorical variable into K <= maxCategories clusters to find a suboptimal split. Must be >= 2, values above 15 are clamped to 15.
getter/setter pair
maxDepth ↔ int
The maximum possible depth of the tree, values above 25 are clamped to 25.
getter/setter pair
minSampleCount ↔ int
If the number of samples in a node is less than this parameter then the node will not be split.
getter/setter pair
nodes → List<DTreesNode>
All the nodes of the trees, the children of a node are referenced by index.
no setter
priors ↔ Mat
The array of a priori class probabilities, sorted by the class label value.
getter/setter pair
props → List<Object?>
no setterinherited
ptr ↔ Pointer<Boost>
getter/setter pairinherited
ref → Boost
A view of the native memory behind ptr, not a copy.
no setteroverride
regressionAccuracy ↔ double
Termination criteria for regression trees.
getter/setter pair
roots → List<int>
The indices of the root nodes, one per tree.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
splits → List<DTreesSplit>
All the splits of the trees, referenced by DTreesNode.split and DTreesSplit.next.
no setter
subsets → List<int>
The bitsets of the splits on categorical variables, see DTreesSplit.subsetOfs.
no setter
truncatePrunedTree ↔ bool
If true then pruned branches are physically removed from the tree.
getter/setter pair
use1SERule ↔ bool
If true then a pruning will be harsher.
getter/setter pair
useSurrogates ↔ bool
Whether to build surrogate splits. Not implemented in OpenCV 4.x: training with true throws.
getter/setter pair
varCount → int
Number of variables in training samples.
no setter
weakCount ↔ int
The number of weak classifiers.
getter/setter pair
weightTrimRate ↔ double
A threshold between 0 and 1 used to save computational time.
getter/setter pair

Methods

calcError(TrainData data, bool test) → (double, Mat)
Computes the error on the training (test false) or test (test true) part of data.
calcErrorAsync(TrainData data, bool test) → Future<(double, Mat)>

Available on Boost, provided by the BoostAsync extension

clear() → void
Calls OpenCV's clear, which does not reset this model: it stays trained. Create a new model to start over.
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 Boost, provided by the BoostAsync 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 Boost, provided by the BoostAsync extension

trainWithData(TrainData data, {int flags = 0}) → bool
Trains the model on data, flags may be StatModel.UPDATE_MODEL or model-specific flags.
trainWithDataAsync(TrainData data, {int flags = 0}) → Future<bool>

Available on Boost, provided by the BoostAsync extension

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

finalizer → NativeFinalizer
final

Constants

DISCRETE → const int
GENTLE → const int
LOGIT → const int
REAL → const int