What is overfitting in Decision Trees and why does it happen?
Updated Feb 20, 2026
Short answer
Overfitting happens when a decision tree becomes too complex and learns noise in the training data instead of general patterns.
Deep explanation
Decision trees keep splitting data until they reach very pure nodes. If allowed to grow without limits, they can create branches for almost every small variation in the dataset. This leads to a very deep tree that performs extremely well on training data but poorly on unseen data.
Overfitting happens because the model memorizes specific examples rather than learning general rules. For instance, instead of learning “high income increases loan approval chances,” it might learn overly specific rules like “income = 52,431 and age = 31 leads to approval,” which does not generalize.
Techniques like pruning (removing unnecessary branches), setting maximum depth, or requiring a minimum number of samples per leaf are used to reduce overfitting.
Real-world example
A spam filter that overfits might classify emails as spam only if they match exact phrases seen in training, failing to detect new spam messages with slightly different wording.
Common mistakes
- - Thinking a larger tree is always better.
- - Confusing high training accuracy with good model performance.
- - Ignoring regularization techniques like pruning or depth limits.
Follow-up questions
- What is pruning in decision trees?
- How do you choose the maximum depth?
- What is the bias-variance tradeoff?