Part 7

Rows left out of a tree's bootstrap sample provide an internal prediction check.

Out-of-bag evaluation uses only trees that did not train on a particular row. It is convenient, but it should not be treated as a magical replacement for every validation design.

Read the OOB matrix

Matrix question

For row A, which trees are allowed to predict its OOB estimate?

Training rowTree 1Tree 2Tree 3Tree 4Tree 5
AInOOBInOOBOOB
BOOBInOOBInOOB
CInOOBOOBInIn
DOOBInInOOBIn

Read the row: row A's OOB prediction uses Trees 2, 4, and 5. Tree 1 and Tree 3 must be excluded because they trained on A.

One OOB prediction step by step

Aggregation question

Trees 2, 4, and 5 give row A probabilities 0.70, 0.40, and 0.80 for the positive class. What is the OOB probability?

\[\hat p_{OOB}(A)=\frac{0.70+0.40+0.80}{3}=0.633\]

Repeat this for every row using only its OOB trees, then calculate an OOB metric. With enough trees, most rows receive many OOB predictions.

Row ATree 1: InTree 3: InTree 5: OOBTree 2: OOBTree 4: OOBonly green paths enter the OOB aggregate

OOB versus a held-out test set

OOB estimates are useful during exploration and can help monitor the effect of adding trees. A clean validation or test design remains important, especially for time-dependent data, grouped observations, repeated tuning, or a small dataset.

OOB is not independent from every modeling decision if you repeatedly tune many choices against it. Once used for selection, it behaves like validation information.
Previous: RegressionNext: Variance