What is max depth in Decision Trees and why is it important?

Updated May 16, 2026

Short answer

Max depth limits how deep a decision tree can grow to control overfitting.

Deep explanation

Max depth is a hyperparameter that restricts the number of levels in a decision tree. Deeper trees can model complex relationships but are prone to overfitting. Shallow trees generalize better but may underfit. Choosing optimal depth is a bias-variance tradeoff problem often solved using cross-validation.

Real-world example

In healthcare risk prediction, max depth is restricted to keep models interpretable for doctors.

Common mistakes

  • Setting max_depth too high and assuming more complexity improves accuracy.

Follow-up questions

  • How do you choose optimal max depth?
  • What happens if max_depth is too small?
  • Is max depth the only way to control overfitting?

More Decision Trees interview questions

View all →