KatInterview

Decision Trees: Splits, Hyperparameters, and Ensembles

Machine LearningModel answer
EasyModel answerMachine Learningdecision-treesrandom-forestgradient-boosting

Last updated

Explain how decision trees partition data, how splits are scored for classification vs regression, how hyperparameters control overfitting, and how ensemble methods improve on a single tree.

Background

Decision trees are foundational to many of the strongest models used on tabular data today. Understanding them from first principles — how they split, what they optimize, and why they overfit — is a prerequisite for reasoning about the ensemble methods built on top of them.

Questions

  1. Walk through how a decision tree learns a model from training data, for both classification and regression tasks.
  2. What objective does the tree optimize when choosing a split? Describe the criterion used for classification and for regression, and explain why misclassification error is not a good choice for growing a classification tree.
  3. Name at least four hyperparameters that control tree complexity and describe the direction of their effect on bias and variance.
  4. Choose one ensemble method that builds on decision trees — such as a random forest or a gradient boosted tree model — explain the mechanics, and describe the conditions under which you would prefer it over a single tree, and over the other ensemble.

What is expected

A strong answer explains the mechanics concretely (not just names and buzzwords), includes at least one formula or worked example for the splitting criterion, and discusses trade-offs rather than declaring a single winner. For the ensemble question, go beyond "it reduces overfitting" and explain why at an algorithmic level.

Hints

Hint 1

For the splitting criterion, try writing out the weighted impurity formula for a binary split. Then plug in a simple example — say, 10 samples split into two groups of 5 — to show the gain is nonzero even when the split looks balanced.

Hint 2

For hyperparameters, organize your answer around what part of the tree they constrain (depth, leaf size, complexity penalty) and whether they act before or after the tree is grown.

Hint 3

For ensembles, the key word for random forests is *decorrelation* and for gradient boosting it is *sequential residual fitting*. If you can explain what problem each mechanic is solving, the trade-off between the two methods follows naturally.