- Introduced by
- Clyde, M. & Lee, H. (building on Rubin's Bayesian bootstrap, 1981)
- Year
- 2001
- Type
- Ensemble (Bayesian bootstrap aggregation)
- Family
- Machine learning
What does it do?
Bayesian Bagging is a bagging variant that replaces the classical bootstrap with Rubin's Bayesian bootstrap: instead of resampling observations with replacement, each base learner is trained on Dirichlet-distributed weights over the full training set.
Its aim is to connect ensemble averaging with posterior-style reasoning, so that the spread of ensemble predictions can serve as an informal indicator of variability. That reading depends on modelling assumptions which the Bayesian bootstrap literature treats as consequential, so calibration should be checked on held-out data.
The intuition behind the method
Classical bagging creates diversity by resampling observations with replacement, so each bootstrap sample omits some rows and repeats others. Bayesian bagging, as described on this page, keeps every observation in every training run and instead gives each one a random positive weight drawn from a Dirichlet distribution with all parameters equal to one. These weights follow Rubin's Bayesian bootstrap, which simulates the posterior distribution of a parameter rather than the sampling distribution of a statistic. Each learner therefore sees the same rows with different emphasis, and the spread of their predictions can be read as a rough, informal indication of variability. Whether that spread is well calibrated depends on assumptions that should be checked empirically.
History
The Bayesian bootstrap was introduced by Rubin (1981) as a Bayesian analogue of the bootstrap. It simulates the posterior distribution of a parameter, where the classical bootstrap simulates the sampling distribution of a statistic. The connection between Bayesian bootstrap reweighting and bagging is attributed to Clyde and Lee (2001), an attribution that remains unconfirmed. The method sits at the intersection of ensemble learning and Bayesian non-parametrics.
When to use it
Use Bayesian Bagging when you want ensemble aggregation together with an informal variability indicator derived from the spread of member predictions, for example in a risk-sensitive tabular problem where the variability of a prediction matters alongside the prediction itself. It requires a base learner that accepts observation weights, such as a weighted decision tree or a linear model with weighted loss. Prefer it over classical bagging only if you need that Bayesian-bootstrap framing and are prepared to check calibration. Avoid it when the base learner cannot take sample weights, when a single interpretable model is required, when computation is tightly constrained, or when the training set is small, because the Dirichlet weights then vary strongly across learners and the spread becomes noisy.
Limitations and considerations
- Each base learner must support weighted training; learners without weights require a workaround that departs from the Bayesian-bootstrap rationale.
- The Bayesian reading of the output depends on model assumptions. Rubin (1981) notes that inferences from the Bayesian bootstrap are generally sensitive to such assumptions, and that it is not a true bootstrap procedure yielding inferences unaided by external assumptions.
- Improvement in predictive accuracy over classical bagging is not established for this method, so no gain should be assumed; compare the two approaches on your own validation data.
- Fitting many weighted learners can cost more than fitting unweighted bootstrap samples, and the number of members needed for a stable spread depends on the data and the learner, so it has to be determined empirically.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Every observation enters every base learner with a positive weight, so no training row is omitted from any member as can happen under bootstrap resampling.
- The procedure is compatible with any base learner that accepts sample weights, so the choice of learner is not fixed by the method.
- The spread of member predictions gives a variability indicator motivated by the Bayesian bootstrap, although its calibration is not guaranteed and must be checked.
- Diversity among members comes from continuous reweighting of the same data rather than from duplicated and omitted rows.
Applications
- Regression or classification on tabular data where the spread of ensemble predictions is wanted as an uncertainty indicator alongside the point prediction.
- Settings where a sample-weighted base learner is already in use and a bagging-style ensemble with a Bayesian-bootstrap motivation is required.
- Benchmarking against other Bayesian ensemble approaches, where a simple, clearly stated baseline is useful.
- Risk-sensitive domains such as clinical or financial prediction, provided the spread has been checked for calibration on held-out data.
How it works
How it works
Instead of drawing a bootstrap sample with replacement, each base learner receives a weight vector drawn from a Dirichlet(1,...,1) distribution over all n training observations. Every observation receives a positive weight in every learner, which is the main structural difference from classical bagging. Rubin's Bayesian bootstrap motivates this weighting as a way of simulating the posterior distribution of a parameter under stated model assumptions.
A base learner, typically a decision tree but in principle any model that accepts sample weights, is fitted to the training data using these weights. The weight on each observation enters the learner's loss, so heavily weighted observations pull the fitted model more strongly. This step is repeated for B learners, each with its own weight draw.
The Dirichlet draws are the mechanism that links this procedure to posterior-style reasoning: under Rubin's Bayesian bootstrap, weights of this kind simulate the posterior distribution of a parameter, and the resulting inferences depend on model assumptions that Rubin (1981) describes as consequential. The spread of member predictions should therefore not be read as a posterior predictive distribution unless those assumptions are shown to hold.
Formula
w_b \sim \text{Dirichlet}(\mathbf{1}_n),\quad \hat{f}(x)=\sum_{b=1}^{B} w_b \hat{f}_b(x)The B learner outputs are combined by averaging for regression and by a vote for classification, as in classical bagging. The Dirichlet weights act on the training data rather than on the final combination, so this step alone does not make the ensemble more accurate or less variable than classical bagging; any such comparison requires separate evaluation. The spread of learner outputs can be examined as an informal indicator of variability, not as a calibrated uncertainty interval.
Common pitfalls
- Conflating Bayesian bagging with Bayesian model averaging. Both are Bayesian in motivation, but they average over different things: bagging averages learners fitted to reweighted copies of one dataset, while model averaging weights different model structures by their posterior probabilities.
- Substituting bootstrap resampling for sample weights in learners that cannot take weights. This removes the reweighting that the Bayesian-bootstrap rationale depends on.
- Treating the spread of member predictions as calibrated posterior uncertainty. To check it, hold out labelled data, form a central interval from lower and upper quantiles of the member predictions at a chosen nominal level, and compare that nominal level with the observed coverage on the held-out data. A large gap means the spread should not be used as a statement of uncertainty.
- Using too few ensemble members, so that the spread changes noticeably with the random seed. Increase B and repeat the fit with different seeds until the interval endpoints change by less than a tolerance you set in advance; that tolerance is a user choice, not a value taken from the cited sources.
Frequently asked questions
How does Bayesian bagging differ from classical bagging?
Classical bagging resamples observations with replacement, so some are included several times and others not at all. Bayesian bagging instead draws Dirichlet-distributed weights over all observations, so every observation is present in every learner with a varying weight. The weighting is motivated by the Bayesian bootstrap, which gives the spread of predictions a Bayesian reading under stated model assumptions.
Can I use any base learner with Bayesian bagging?
In principle yes, as long as the learner accepts sample weights or observation importance. Decision trees, linear models, and other learners with a weighted loss are examples. Learners that do not support weights require a workaround that departs from the Bayesian-bootstrap rationale.
How many ensemble members B do I need?
No fixed minimum for B is established for this method. Choose B by repeating the fit with different random seeds and checking whether the spread of predictions, such as the width of a central interval, stays stable. Once it does, adding members brings little further benefit.
Is Bayesian bagging the same as Bayesian model averaging?
No. Bayesian model averaging weights different model structures or parameterisations by their posterior model probabilities. Bayesian bagging averages learners fitted to Dirichlet-reweighted versions of the same training data; it does not weight competing model structures in this way.
When should I prefer classical bagging over Bayesian bagging?
When your base learner does not support sample weights, when a variability indicator is not needed, or when computation is the main constraint and the classical bootstrap is simpler to run in your software stack.
Related methods
Sources
Clyde, M. & Lee, H. (2001). Bagging and the Bayesian bootstrap. In T. Richardson & T. Jaakkola (Eds.), Proceedings of the Eighth International Workshop on Artificial Intelligence and Statistics (AISTATS 2001).
Open publication referenceRubin, D. B. (1981). The Bayesian bootstrap. The Annals of Statistics, 9(1), 130–134.
Open DOI reference