#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
🌲 FREE · TREES FROM SCRATCH

Random Forest Visualizer: Many Trees, One Smoother Answer

Grow 1 to 100 decision trees on bootstrap samples and see how their votes combine.

  • 🗳️ Vote map
  • 🎒 Bootstrap + OOB
  • 🌳 Individual trees

How to use the Random Forest Visualizer

  1. 1. Pick dataChoose moons, circles, XOR or overlapping clusters, the number of points and a seed.
  2. 2. Set the forestChoose the number of trees, max depth, features per split and bootstrap sampling.
  3. 3. Grow itSee the vote map, the first six trees and the accuracy figures.

What a random forest does

A single decision tree splits the plane into rectangles and can overfit badly. A random forest grows many trees, each on a bootstrap sample (rows drawn with replacement) and choosing from a random subset of features at each split, then lets them vote. The trees make different mistakes, so the vote is smoother and usually more accurate than any one tree. Rows left out of a tree's bootstrap sample give a free test set, the out-of-bag (OOB) accuracy.

Worked example

With the defaults (two moons, 200 points, seed 7, 25 trees, max depth 5, 1 random feature per split, bootstrap on), the forest scores 92.0% on training data and 76.8% on 400 new test points, with 74.5% out-of-bag accuracy. The first tree on its own scores 69.8% on the same test set, so the forest improves on a single tree by 7 points.

Notes

  • Trees are CART trees grown with Gini impurity, as in scikit-learn. With all features and no bootstrap, a tree we grow makes the same predictions as scikit-learn's DecisionTreeClassifier across a 40 × 40 grid.
  • Deeper trees fit training data better; the forest's averaging limits the overfitting.
  • OOB accuracy needs bootstrap sampling turned on.
  • Try the XOR data with max depth 1: every tree is a single split, so the forest can't learn the four corners however many trees you add.

Frequently asked questions

How many trees do I need?

Accuracy usually stops improving after a few dozen to a few hundred trees. More trees don't overfit; they just cost more time.

Why only two features?

So the decision regions can be drawn on a flat chart. Real forests use as many features as your data has.

Is the random forest visualizer free?

Yes. You can open the random forest visualizer and enter everything without signing up. When you grow a forest for the first time, we ask once for your name and WhatsApp number; after that it, and every other Uncodemy tool, opens straight away.

More free tools

See all free tools