Decision Tree Builder
CART grows a decision tree by repeatedly cutting the plane with the axis-aligned split that most reduces class impurity, measured by the Gini index or entropy. Load blob, checkerboard or diagonal data — or click to add points of three classes — set the maximum depth, the minimum samples per leaf and the criterion, then press Play and watch the splits appear one by one: the partition map shades every region by its majority class while the tree diagram below grows the matching nodes, each labelled with its sample count and impurity. A fixed 70/30 train/test split feeds the accuracy readouts, and the diagonal preset exposes the axis-aligned weakness: a staircase of cuts approximating one slanted line.
Runs 100% in your browser — models are trained and computed locally on your device.
Read the full guide to this tool
Notes
- Each split maximises the impurity decrease; Gini is 1 − Σpₖ² and entropy is −Σpₖ·log₂pₖ over the class shares pₖ in the node.
- Growth stops when a node is pure, the maximum depth is reached, or a split would leave fewer than the minimum samples in a leaf.
- Deeper trees push training accuracy toward 100% while test accuracy eventually falls — the tree memorises noise instead of structure.
- Splits are always axis-aligned, so an oblique class boundary needs a whole staircase of cuts that a linear model would capture with one line.
- Runs 100% in your browser — models are trained and computed locally on your device.