One split is a stump. Keep splitting and you get a tree.
The flowchart model: nonlinear, multi-class, no scaling — and prone to overfit.
max_depth=1 build_tree is the week-1 classifier.Iris in 2-D: petal length vs width, three species. Setosa is one free cut away.
Gini impurity — the chance you'd mislabel a random draw:
G=1−k∑pk2A split's worth is the size-weighted impurity it removes:
Δ(j,t)=G(parent)−N∣L∣G(L)−N∣R∣G(R)Train a node by the argmax over every feature and threshold. That's the week-1 search, run over all features and again inside each child.
Every frame is one real split, best-first. The plane gets chopped into boxes, each shaded by the class it predicts. Seven splits, training accuracy 0.993.
Train accuracy climbs to 0.998. Test accuracy peaks at 0.736 (depth 4), then falls to 0.662. Every split past depth 4 memorizes noise.
DecisionTreeClassifier(max_depth=4) grows the same tree: 0.736 test, 16 leaves,
identical to ours. On noisy Pima, three levels of tree beat the week-1 stump
(0.732) by four thousandths — depth isn't free accuracy.