Following a Decision Tree Prediction

A trained decision tree can route a row through chosen feature tests until it reaches a leaf carrying a prediction.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace one row
  2. Record the reason path
  3. Follow one branch at each tested split
  4. Check missing values against the trained rule

Trace one row

A tree might test weight below five, then distance at least ten in one branch. Weight five follows the first test's other side. See comparison endpoints.

Record the reason path

For a small model, list the tests actually visited and chosen branches. A new input can differ in a field the path never reads. Decision tree splits explains how such branches can be selected during training.[1]

Follow one branch at each tested split

A tree branches left when size is at most six. That child predicts repair when age exceeds three, otherwise inspect. For size six and age four, the first boundary sends the input left and the next sends it to repair. See inclusive and exclusive tests.

Size 6 ≤ 6 → left
Age 4 > 3 → repair leaf
Size 7 → other subtree regardless of this left child's age test

Check missing values against the trained rule

Some models reject missing inputs while others learn or specify a branch. A hand trace should use only the splits on the chosen path. Test exact threshold and an unknown feature.

References

  1. Gareth James et al., An Introduction to Statistical Learning ↩