Random Forest

A forest of trees picks your next movie

A random forest grows many deep decision trees, each on a different random sample of the data, and lets them vote. Each tree overfits in its own way; the vote cancels the mistakes they don't share.

Imagine you’ve rated 210 movies, each tagged with how much action and how much comedy it has, and a recommender has to guess which new movies you’ll like. This demo builds a random forest from scratch to do it. The big map shades every spot by the share of trees voting “like”; the six small maps show single trees, each trained on its own bootstrap sample of your ratings.

Start with the five-step walkthrough: one tree on its own, bootstrap samples, the vote, the out-of-bag estimate, and why shallow trees can’t be rescued by voting. Then hover any movie to see how each tree voted on it, and which trees never saw it.

Built with plain JavaScript and SVG, with no ML library. The 300 movies and their titles are fictional, generated from a fixed seed: each “like” is drawn from a taste centered on action comedies, so ratings near the edge of that taste are noisy. 210 movies train the forest and 90 are held out for testing, so the results are identical on every load.