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
- 01On XOR, no single first split helps, so a greedy tree stays near chance until about depth 6. Compare depth 2 with depth 8.
- 02On Circles, notice the staircase: trees can only make axis-aligned cuts.
- 03Raise depth to 10 with min leaf 1 and the test split on: training accuracy hits 100%, test does not.
How it works
- 1Find the single split on one feature that best separates the classes.
- 2Split each side again, recursively.
- 3Stop at the maximum depth or minimum leaf size; each leaf predicts its majority class.
- 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
Logistic regression
Models the probability of a class with a weighted sum passed through a sigmoid.
k-nearest neighbours
Classifies a point by the majority class among its k nearest neighbours.
Naive Bayes (Gaussian)
Applies Bayes’ theorem, assuming each feature is normally distributed and independent within a class.