Skip to content
ML to LLMs
Labs / Classical ML

Build a decision tree

Pick features and thresholds, see Gini before and after each split, and grow the tree region by region.

Theory and worked examples: Decision trees

Build a decision tree

Synthetic customers. Pick a leaf (click a region), choose a feature and threshold, then split.

Feature space partitioned by the tree20304050607020406080100120ageincome ($k)
did not buy (circles)bought (squares)candidate split

Weighted child Gini (30×0.231 + 30×0.358) / 60 = 0.294, a decrease of 0.201 from the parent.

A split is good when its children are purer than the parent. Try the threshold slider and watch the decrease peak; that peak is what the tree-growing algorithm searches for.