RandomForestClassifierStat
Online random-forest classifier; the classification counterpart of RandomForestRegressionStat. Same diversity tricks (Oza & Russell bagging, per-leaf mtry), but per-tree leaves are ClassCountsResult and ensemble predictions average per-class probabilities across trees.
Use cases: online classification wanting ensembled diversity and a per-class probability estimate averaged across trees. Reach for DecisionTreeClassifierStat alone when a single tree suffices.
Memory: O(nbrTrees · single-tree memory); see DecisionTreeClassifierStat. Heavier but parallelisable.
Update: O(nbrTrees · depth) per observation; each tree's update is independent. Under bagging = true, each tree applies a fresh Poisson(1)-reweighted version of the update.
Concurrency: Inherits DecisionTreeClassifierStat's per-tree concurrency model. Trees are updated sequentially within a single update() call (no inner parallelism); concurrent callers each contend for each tree's split lock independently.
Constructors
RandomForestClassifierStat
Properties
bagging
concurrency
Thread-safety mode fixed at construction. See Concurrency for the shared contract and the implementation's KDoc for its cell and lock strategy.
config
ClassificationTreeConfig with ClassificationTreeConfig.mtry defaulted to ceil(sqrt(p)) when null.
featureSize
Number of features expected in x on each update. Mismatched lengths throw.
nbrTrees
numClasses
Number of classes; y must round to [0, numClasses).
splitCandidates
Candidate split pool. Used by every tree; the per-leaf mtry filter draws from here.
Functions
create
Create an independent accumulator at the configured baseline. A null concurrency preserves this accumulator's mode; a non-null value overrides it. Modality subtypes narrow the return type to preserve the input shape.
merge
Fold a compatible snapshot values into this accumulator at timestampNanos. Implementations document whether the combine is exact or approximate and which state the snapshot omits. The source accumulator is unaffected.
Time-dependent statistics, such as windows, place the snapshot at timestampNanos, which must share the clock the caller uses for updates and reads. Time-independent statistics ignore it.
read
Return the current result evaluated at timestampNanos. Time-independent statistics ignore the timestamp. Reading does not add an observation.
Snapshot consistency depends on the implementation's synchronisation. Locks protect coupled state under Concurrency.Strict and Concurrency.HighWrite; independently updated cells and JVM striped adders can still yield a best-effort snapshot. Concurrency.Relaxed permits drift across coupled cells.
reset
trees
Live underlying classification trees. Use for inspection.
validateMerge
Convenience overload that wraps x as a DenseVector.
Timestamped convenience overload that wraps x as a DenseVector.
Record the pair (x, y) with weight at timestampNanos.