Skip to content

Voting forest

Train a Random Forest in your browser and compare one tree alone with the whole forest.

What this lab shows

A Random Forest brings together many decision trees, each trained on a random sample of the data and drawing attributes at each question. Here the trees are really trained in your browser, and you see side by side the boundary of one tree alone and that of the forest, the vote at a point and the accuracy on data no tree has seen.

Points generated by a made-up rule, with noise. The trees, the random draws and the vote are really computed.

How to use it

  1. With one tree and no depth limit, compare the accuracy on training data with the accuracy on new data.
  2. Raise the number of trees and watch the forest boundary get smoother and the accuracy curve level off.
  3. Tap a spot in the drawing to see how many trees voted yes there and the path of one of them.
LabVoting forestTry it

Illustrative dataPoints generated by a made-up rule, with noise. The trees, the sampling and the vote are really computed in your browser.

Forest of 25 trees trained on the map example. Red background: the forest predicts crime; blue background: it does not. Each point is a small square of the map. Red: there was a crime the next month. Blue: there was not. → records in the last 12 weeks; ↑ distance to the station (km).
What to notice: The lone tree gets everything right on training data and makes more mistakes on new data: it memorized the noise. Each tree in the forest makes different mistakes, and the vote cancels part of them. The OOB estimate stays close to the accuracy on new data without using any test data.

Books that use this lab

No published book uses this lab yet.