How is the Out-of-Bag prediction computed for an individual training instance?

Quick Overview

Asks how a random forest computes the out-of-bag prediction for one training row. Tests understanding of bootstrap sampling, which trees may vote, how votes or probabilities are combined, why in-bag trees are excluded, and the case where a row has no out-of-bag trees.

How is the Out-of-Bag prediction computed for an individual training instance?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

A random forest is trained with bootstrap sampling, so each tree sees only a resampled subset of the training rows. How is the Out-of-Bag (OOB) prediction computed for an individual training instance? ```hint Which trees qualify Think about which trees in the forest never saw this instance while they were being trained. ``` ### What a Strong Answer Covers - Which trees contribute to the instance's OOB prediction, and roughly what fraction of the forest that is - How the contributing tree outputs are aggregated for classification and for regression - Why the trees that trained on the instance must be excluded - What happens when no tree has the instance out-of-bag ### Follow-up Questions - Why is each instance out-of-bag for roughly 37% of the trees? - How do OOB predictions give an error estimate without a separate validation set, and when is that estimate biased? - How does setting `max_samples` below the number of training rows change the OOB sets?

Overview: Asks how a random forest computes the out-of-bag prediction for one training row. Tests understanding of bootstrap sampling, which trees may vote, how votes or probabilities are combined, why in-bag trees are excluded, and the case where a row has no out-of-bag trees.

Nov 24, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

A random forest is trained with bootstrap sampling, so each tree sees only a resampled subset of the training rows. How is the Out-of-Bag (OOB) prediction computed for an individual training instance?

What a Strong Answer Covers Guidance

  • Which trees contribute to the instance's OOB prediction, and roughly what fraction of the forest that is
  • How the contributing tree outputs are aggregated for classification and for regression
  • Why the trees that trained on the instance must be excluded
  • What happens when no tree has the instance out-of-bag

Follow-up Questions Guidance

  • Why is each instance out-of-bag for roughly 37% of the trees?
  • How do OOB predictions give an error estimate without a separate validation set, and when is that estimate biased?
  • How does setting max_samples below the number of training rows change the OOB sets?