🌳 Decision Trees and Random Forests
How decision trees learn a sequence of if-else rules from data, why a single tree tends to overfit, and how random forests combine many imperfect trees into an accurate, stable model.
A 2D feature space rendered as a 3D meadow, carved into class-colored regions by a decision tree — or smoothed into a stable boundary by a growing forest of trees standing beside it.
🔬 What It Demonstrates
Each rectangle on the floor is a real leaf of the trained tree, split by whichever feature and threshold most reduces class impurity. Deeper trees carve smaller, jagged, overfit shards; a forest of bootstrap-resampled trees averages its votes into a smoother, more reliable boundary.
🎮 How to Use
Switch between a single tree and a random forest, raise the max depth to watch overfitting appear, grow the number of trees to watch the boundary smooth out, and adjust label noise to see how much harder overlapping classes are to separate.
💡 Did You Know?
Random forests work because each tree, trained on a different bootstrap sample with randomized splits, makes largely uncorrelated errors — averaging cancels out the noise even though every individual tree still overfits its own sample.
How decision trees learn a sequence of if-else rules from data, why a single tree tends to overfit, and how random forests combine many imperfect trees into an accurate, stable model.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install