A decision tree is a flowchart of yes/no questions. Watch it carve the plane into boxes, see how it picks each question, and learn when to stop it growing.
At the root, the tree tries every threshold on both x and y. For each, it measures how mixed the two sides are using impurity (0 = one class only), weights them by size, and keeps the lowest. The drop from the parent's impurity is the gain.
Each depth is a different tree. Train accuracy only climbs as the tree grows. Test accuracy peaks, then slips: deep trees carve tiny boxes around single noisy points. Click the chart to try a depth.
Every path from the root to a leaf is a rule. Requiring more points in each leaf stops the tree from isolating single outliers. This table regrows your current depth at each minimum leaf size. Click a row to use it.
Too large a minimum leaf size and the tree cannot make the splits it needs, so it underfits. Tune it with test accuracy.
XOR corners with a depth-1 tree. One cut cannot separate four corners, so accuracy stays near a coin flip.
Noisy clusters with depth 10 and leaves of one point. The tree builds little islands around every mislabeled dot.
Keep depth 10 but demand bigger leaves. The islands vanish and test accuracy recovers.