ClassificationSample

Decision tree

Learns a sequence of yes/no questions on the features that ends in a class.

Synthetic data, generated and trained in your browser.

Try this

  1. 01On XOR, no single first split helps, so a greedy tree stays near chance until about depth 6. Compare depth 2 with depth 8.
  2. 02On Circles, notice the staircase: trees can only make axis-aligned cuts.
  3. 03Raise depth to 10 with min leaf 1 and the test split on: training accuracy hits 100%, test does not.

How it works

  1. 1Find the single split on one feature that best separates the classes.
  2. 2Split each side again, recursively.
  3. 3Stop at the maximum depth or minimum leaf size; each leaf predicts its majority class.
  4. 4Boundaries are always parallel to the axes.

What the controls teach

Max depth
Number of questions in a row. Deeper trees carve finer, more overfit regions.
Min samples per leaf
The fewest points a leaf may hold; larger values prune tiny regions.

Use it when

  • Explainable rules
  • Mixed feature types with no scaling needed

Avoid it when

  • Smooth or diagonal boundaries
  • Deep trees without pruning

More in Classification