🌳 Decision Trees & Random Forest

Explore how trees split the space and how forests improve generalization. Add points, train a tree or an ensemble, and watch the decision regions and feature importance update live.


Dataset & Model
Class 1 Class 0
Tip: Click on the plot to add a point of the selected class. Toggle class in Dataset controls.
Train Acc
Test Acc
Depth
Leaves
Feature Importance
Importance is computed as total impurity reduction contributed by each feature (averaged across trees for forests).
📦 Dataset
Train/Test Split80/20
🌲 Decision Tree
Max Depth5
Min Samples Split4
Min Leaf2
🌳 Random Forest
# Trees15
Max Features (per split)1

About this Visualizer
What is a Decision Tree?
  • Axis-aligned splits: Recursively partition the space with x or y thresholds
  • Leaves: Each leaf predicts the majority class of points in that region
  • Impurity: Gini or Entropy guide how to split (lower is better)
  • Complexity: Max depth, min samples, and min leaf prevent overfitting
Why Random Forest?
  • Ensemble: Averages many trees to reduce variance
  • Bagging: Trains each tree on bootstrap samples
  • Random features: Uses a random subset of features for each split
  • Robustness: Typically generalizes better than a single tree
Interpreting Results
  • Decision regions: Red vs Green areas indicate predicted classes
  • Splits: Dashed blue lines show tree thresholds
  • Accuracy: Computed from a random train/test split
  • Feature importance: Total impurity reduction per feature
Troubleshooting
  • Underfitting: Increase max depth or decrease min samples
  • Overfitting: Decrease max depth or increase min samples
  • Noisy boundaries: Use more trees, enable bootstrap, limit features

Support This Free Tool

Every coffee helps keep the servers running. Every book sale funds the next tool I'm dreaming up. You're not just supporting a site — you're helping me build what developers actually need.

500K+ users
200+ tools
100% private
Privacy Guarantee: Private keys you enter or generate are never stored on our servers. All tools are served over HTTPS.

About This Tool & Methodology

Compares a single decision tree with an ensemble random forest. Demonstrates bagging, feature subsampling, out‑of‑bag intuition, and aggregated feature importance (where supported).

Learning Outcomes

  • See variance reduction from ensembling vs a single deep tree.
  • Interpret feature importance cautiously (correlated features caveat).
  • Relate hyperparameters (n_estimators, max_features) to bias–variance trade‑off.

Authorship & Review

  • Author: 8gwifi.org engineering team
  • Reviewed by: Anish Nath
  • Last updated: 2025-11-19

Trust & Privacy

  • All computations run locally; datasets are not uploaded.