OverFit
Fit the rule, not the noise.
An interactive simulator of binary or multiclass classification by a decision tree. Cut the board to train the tree on the points you see (blue, orange and green are different classes), then test it on points it has never seen, and answer the question every machine learning model faces: does it generalize, or does it overfit or underfit?
○ new points× wrong for the tree● training points, faded
Click a grid line inside a region to cut; V or H keeps the cut vertical or horizontal. Hover over a point to see its path through the tree. Drag along the grid to cut a region. Tap a point to see its path.
Your decision tree, growing live with every cut
The overfitting curve
The lines show the trees a library grows as you raise its cap on leaves (max_leaf_nodes in scikit-learn): each step adds the cut that removes the most Gini impurity, weighted by the points it splits. Training accuracy never falls. On every board of this game but one, accuracy on new data peaks at the rule's own cuts and never rises again after them: the boards are chosen so that this holds, and the test suite checks it. The exception is Beat the library, where the library's first cut is wrong on purpose. On real data the curve is noisier: it can wobble, it can rise again after a dip, and nobody tells you how many cuts the rule has.
Careful: once you have seen the new data, every change made to score better on it uses it to choose the tree, and its score stops being a fair measure of how well the tree generalizes. Real projects tune on a validation set or by cross-validation and open the test set once, at the end: that is why each extra test costs a star.