Why does out-of-bag error fail as an evaluation metric on time-series data?

Quick Overview

Asks why a random forest's out-of-bag error is a misleading evaluation metric when the rows come from a time series, and what validation to use instead. Tests understanding of bootstrap sampling, autocorrelation leakage, look-ahead bias, drift and walk-forward validation.

Why does out-of-bag error fail as an evaluation metric on time-series data?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

Why does out-of-bag error fail as an evaluation metric on time-series data? A random forest's out-of-bag (OOB) error is a convenient built-in estimate of generalization error. Explain why it gives a misleading picture when the rows are observations of a time series, and what you would use instead. ```hint Compare the two settings Ask which rows sit next to an out-of-bag row in a tree's bootstrap sample, and compare that with what the model has seen when it forecasts next month in production. ``` ### What a Strong Answer Covers - How bootstrap sampling ignores time order, and which rows end up next to each OOB row - Leakage through autocorrelation and lag features - Look-ahead bias from trees trained on rows that come after the one being scored - The effect of drift and of the forest's inability to extrapolate - Which validation schemes to use instead, and why a gap between train and test windows helps ### Follow-up Questions - How large should the gap between train and test windows be when features use a 30-day rolling window? - Does a block bootstrap fix the problem? When is it still useful? - If you have to use a random forest on a trending series, how would you set up the target so the model can cope with the trend? - When is OOB error still a reasonable estimate on data that carries timestamps?

Overview: Asks why a random forest's out-of-bag error is a misleading evaluation metric when the rows come from a time series, and what validation to use instead. Tests understanding of bootstrap sampling, autocorrelation leakage, look-ahead bias, drift and walk-forward validation.

PracHub logo
General
Nov 24, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

Why does out-of-bag error fail as an evaluation metric on time-series data?

A random forest's out-of-bag (OOB) error is a convenient built-in estimate of generalization error. Explain why it gives a misleading picture when the rows are observations of a time series, and what you would use instead.

What a Strong Answer Covers Guidance

  • How bootstrap sampling ignores time order, and which rows end up next to each OOB row
  • Leakage through autocorrelation and lag features
  • Look-ahead bias from trees trained on rows that come after the one being scored
  • The effect of drift and of the forest's inability to extrapolate
  • Which validation schemes to use instead, and why a gap between train and test windows helps

Follow-up Questions Guidance

  • How large should the gap between train and test windows be when features use a 30-day rolling window?
  • Does a block bootstrap fix the problem? When is it still useful?
  • If you have to use a random forest on a trending series, how would you set up the target so the model can cope with the trend?
  • When is OOB error still a reasonable estimate on data that carries timestamps?