Skip to content

Decision Tree

A model that makes a decision along a chain of conditions: a feature value is compared with a threshold, and the object goes down the corresponding branch. The check is repeated until the object reaches a leaf with a prediction. Trees are used for both classification and regression.

How it is arranged

  • root — the first node where the check starts;
  • internal node — checks a condition of the form \(x_j \le t\), where \(t\) is a threshold;
  • branch — a transition to the next node;
  • leaf — the final node with a prediction: a class or a number.

An object passes only the conditions that lie on its path. The other nodes of the tree are not checked for this object, so the prediction can be explained as a sequence of rules.

How a tree is trained

A tree is built greedily and recursively:

  1. possible splits are enumerated in the current node;
  2. each one is scored by a quality criterion;
  3. the best one is chosen;
  4. the procedure is repeated for the child nodes until a stopping condition is met.

For classification the criterion is entropy or Gini impurity, for regression it is the squared error inside the nodes. The best split itself is chosen by information gain. A greedy choice does not guarantee a globally optimal tree structure.

For a full binary tree the relation \(L = I + 1\) holds: the number of leaves is one greater than the number of internal nodes.

Strengths and limitations

Strengths Limitations
rules read as a sequence of conditions the structure is unstable to the training sample
captures non-linear dependencies a deep tree overfits
usually does not require standardization of features regression predictions are stepwise

Ensembles help reduce the instability: bagging and random forest. The risk of overfitting is reduced by limiting complexity and by pruning.

See also

← All terms