Skip to content

Bootstrap

A sample obtained from the original dataset by random selection with replacement: after each pick the object is returned to the set and can be drawn into the sample again.

Sampling with Replacement

Let the original dataset consist of four objects:

\[ A,\ B,\ C,\ D. \]

In sampling without replacement each object is used at most once, so a possible sample is \(A,\ C,\ D\).

In sampling with replacement the object is returned to the set after being picked, so the same record can appear several times:

\[ A,\ C,\ A,\ D. \]

Here object \(A\) is picked twice, and object \(B\) is never picked. The size of a bootstrap sample usually equals the size of the original dataset, but the number of unique objects in it is smaller.

How Many Objects Stay Out of the Sample

Some of the original objects do not get into the sample. For a dataset of \(n\) objects, the probability that a particular object is not picked in any of the \(n\) draws is

\[ \left(1-\frac1n\right)^n \approx \frac1e \approx 0.37. \]

Therefore a bootstrap sample contains about 63% of the unique objects of the original dataset. The remaining objects are called out-of-bag for the model trained on that sample.

Where It Is Used

  • building ensembles: several samples from one dataset yield models trained on slightly different data;
  • OOB evaluation of model quality without a separate test set;
  • estimating the spread of statistics: samples are drawn repeatedly, and the uncertainty of the result is measured from them.

Bootstrap produces samples of the same size but with repetitions. This differs from splitting the data into non-overlapping parts in cross-validation.

See also

← All terms