Machine Learning
Random Forests — Bagging for Trees
Forest of 50 trees
Data
Forest
Each tree trains on a random sample drawn with replacement.
Forest test accuracy
96.0%
Forest train accuracy
99.6%
Average single tree (test)
89.0%
Out-of-bag accuracy
91.1%
Each point scored only by trees that never saw it.
Feature importance (x1 / x2)
52% / 48%
How to use this tool
- 1Pick a dataset, the number of points and the noise.
- 2Set the number of trees, depth, leaf size, bootstrap and features per split.
- 3Compare the forest’s decision regions with any single tree.
- 4Read test accuracy, out-of-bag accuracy and feature importance.
Frequently asked questions
Each deep tree overfits its own bootstrap sample in a different way. Averaging many such trees cancels much of that noise, so the forest generalises better.
About a third of the training points are left out of each tree’s bootstrap sample. Scoring each point only with the trees that never saw it gives a free estimate of test accuracy.
With the CART algorithm and Gini impurity, splitting at midpoints between values — the same method as scikit-learn’s DecisionTreeClassifier.
No. Everything is calculated in your browser; nothing you enter is sent to MuhammadLab.
Related tools
Classification Studio — Random Forest vs XGBoost
Interactive classification playground: upload a CSV, choose features + target, and compare tree-based classifiers (Random Forest mode and XGBoost boosting). See accuracy, confusion matrix, precision/recall/F1, and export Python code.
Logistic Regression — Classification Basics
Train logistic regression with gradient descent on 2D data: probability map, threshold, confusion matrix and ROC.
Naive Bayes — Fast Probabilistic Classification
See naive Bayes at work: Gaussian NB on 2D data with class means and spreads, and a spam filter with per-word evidence.