Trees & ensembles · /forest

Random forest

Bagging plus one crucial twist: each split flips a seeded coin and considers only one feature, decorrelating the trees. The loss curve tracks out-of-bag error — validation you get for free.

class 0class 1filled = train, hollow = testhover to probe · click to pin
step 0OOB err train acc test acc

Data

datasetpoints150noise0.15seedsplitmouse
Forest prediction
Feature subsampling
With m = 1, each split flips a coin between x₁ and x₂ — this decorrelates the trees, which is what separates a random forest from plain bagging.
Out-of-bag error
A free validation estimate: every point is out-of-bag for ≈ 37% of the trees. OOB points are ringed on the canvas.
What's simplified here
  • With d = 2 features, "random subspace" means one random feature per split (m = 1); real forests use m ≈ √d of many features.
  • OOB error counts only train points left out of at least one bag, judged solely by trees that never saw them.
  • No feature importance in v1.