What is out-of-bag (OOB) error in a Random Forest?

Quick Overview

Asks what out-of-bag error is in a random forest and how it is computed from the rows each tree never saw in its bootstrap sample. Tests understanding of bootstrap sampling, OOB aggregation and when the estimate is biased or invalid.

What is out-of-bag (OOB) error in a Random Forest?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

What is out-of-bag (OOB) error in a Random Forest? Explain where the out-of-bag samples come from, how the error is computed, and when you can trust it. ```hint Start from the bootstrap Each tree is trained on a sample drawn with replacement. Ask which rows a given tree never saw, and what those rows could be used for. ``` ### What a Strong Answer Covers - How bootstrap sampling leaves each tree with a set of rows it never trained on, and roughly what fraction that is. - How OOB predictions are formed per sample and aggregated into an error metric. - Why the OOB estimate can stand in for a holdout set or cross-validation. - The situations where the OOB estimate is biased or invalid. ### Follow-up Questions - Why is the OOB error slightly pessimistic compared with the error of the full forest? - How would you use OOB predictions to compute permutation feature importance? - Your rows are daily snapshots of the same customers. Is the OOB error still a fair estimate? What would you use instead? - Can you compute an OOB error for gradient boosting? Why or why not?

Overview: Asks what out-of-bag error is in a random forest and how it is computed from the rows each tree never saw in its bootstrap sample. Tests understanding of bootstrap sampling, OOB aggregation and when the estimate is biased or invalid.

Nov 24, 2026
easyMachine Learning EngineerOtherMachine Learning
0
0

What is out-of-bag (OOB) error in a Random Forest? Explain where the out-of-bag samples come from, how the error is computed, and when you can trust it.

What a Strong Answer Covers Guidance

  • How bootstrap sampling leaves each tree with a set of rows it never trained on, and roughly what fraction that is.
  • How OOB predictions are formed per sample and aggregated into an error metric.
  • Why the OOB estimate can stand in for a holdout set or cross-validation.
  • The situations where the OOB estimate is biased or invalid.

Follow-up Questions Guidance

  • Why is the OOB error slightly pessimistic compared with the error of the full forest?
  • How would you use OOB predictions to compute permutation feature importance?
  • Your rows are daily snapshots of the same customers. Is the OOB error still a fair estimate? What would you use instead?
  • Can you compute an OOB error for gradient boosting? Why or why not?