Bagging vs Dropout: Two Ways to Average Many Models
Bagging and dropout are both ways of averaging over many models, but they build those models in different ways, and that changes what each can fix. Bagging resamples the training cases and trains a separate predictor on each resample. Dropout randomly masks the units of a single network, so the many models it averages over share one set of weights and are never trained as separate networks.
Leo Breiman's bagging, short for bootstrap aggregating, makes "replicate data sets, each consisting of N cases, drawn at random, but with replacement" from the learning set. Each case may appear several times in a replicate or not at all. A predictor is built on each replicate, and the aggregate averages their predictions for a numerical outcome or takes a plurality vote for a class label. Breiman's condition is instability: if perturbing the learning set can cause significant changes in the predictor, bagging can improve accuracy.
Try it by hand. Take a learning set of N = 5 cases, A, B, C, D, and E, and draw 5 times with replacement. One possible replicate is A, C, C, E, A. Case A appears twice, C twice, and E once, while B and D are absent. How likely is a given case to be left out of a replicate? Each draw misses it with probability 4/5, so all five draws miss it with probability (4/5)⁵ = 0.328, and it appears at least once with probability 1 − 0.328 = 0.672. For N = 10 that chance is 0.651, and for N = 100 it is 0.634. Breiman gives the large-N limit: the probability that a case occurs at least once is 1 − 1/e ≈ 0.632. So each replicate holds roughly two-thirds of the distinct cases, which is why the separate predictors differ from each other and why averaging them helps an unstable method.
Dropout does something else. Srivastava and coauthors describe a network with n units as a collection of 2ⁿ possible thinned networks that "all share weights," and say that for each training case a new thinned network is sampled and trained. At test time it is not feasible to average that many, so they use one network with no dropout whose weights are scaled: if a unit is retained with probability p in training, its outgoing weights are multiplied by p at test time. They call this "a very simple approximate averaging method." (The 14 November note on dropout covers that mechanism in detail.)
Put side by side: bagging changes the data each model sees, dropout changes the structure of the one model, and bagging trains its models independently, while dropout trains all of its thinned networks together through shared weights. Bagging averages predictions at test time. Dropout approximates that average with a single scaled network.
The trap: saying dropout is exactly bagging. The ensemble picture helps, but the models are not independent, they are not resamples of the data, and the test-time average is an approximation.
Prof Rod's rule: when someone says "it's an ensemble", ask what varies between the members, and whether they were ever trained apart.
The five-case example is invented.