An out-of-bag (OOB) observation is a training example omitted from one bootstrap sample. Because its corresponding estimator never sees it during learning, it acts like held-out data. section 2.2.1
Bootstrap sampling draws examples with replacement, so some records repeat while others are selected zero times. Each replicate therefore splits the data into a bootstrap sample for training and an OOB sample for evaluation. section 2.2.1
For each base estimator, the procedure is:
- Draw a same-sized bootstrap sample with replacement. section 2.2.1
- Mark examples never selected as that estimator's OOB observations. section 2.2.1
- Train on the bootstrap sample and use the omitted observations to estimate performance without a separate validation set or cross-validation. section 2.2.1
A 50-record bootstrap sample
Sampling patient-record IDs 0–49 with replacement produces repeated IDs and leaves IDs such as 0, 2, 5, and 10 unselected. Those unselected records form the OOB sample for that replicate. section 2.2.1
Figure 2.3 Bootstrap sampling illustrated on a data set of six examples. By sampling with replacement, we can get a bootstrap sample size of six, containing only four unique objects but with repeats. Performing bootstrap sampling several times produces several replicates of the original data set—all of them with repeats.
Visualize how a six-example dataset produces repeated bootstrap entries and a complementary set of omitted observations. section 2.2.1
With scikit-learn, setting oob_score=True on BaggingClassifier enables OOB evaluation. The resulting OOB score estimates ensemble generalization and can be compared with performance on a separately held-out test set. section 2.2.3
