- Introduced by
- Oza, N. C. & Russell, S.
- Year
- 2001
- Type
- Online ensemble (streaming bagging)
- Family
- Machine learning
What does it do?
Online Bagging is a streaming ensemble method introduced by Oza and Russell in 2001 that adapts Breiman's Bagging framework to data that arrives one instance at a time.
Each arriving instance is presented to every base learner a Poisson(1)-distributed number of times, which approximates bootstrap resampling without storing the data. Because the ensemble is updated incrementally, it can follow a stream, but the basic method does not handle concept drift by itself and needs an added drift detector.
The intuition behind the method
Classical Bagging draws random bootstrap samples from a fixed dataset and trains one model per sample. Online Bagging approximates this without holding the whole dataset: when a new example arrives, it is passed to each base learner a random number of times drawn from a Poisson distribution with mean 1. On average each learner sees the example once, which is the expected behaviour of bootstrap resampling, but the random counts make the learners differ from one another. Since no examples are kept after they are processed, the method suits streams that are too long or too sensitive to store, and the learners keep adjusting as the stream continues.
History
Online Bagging was introduced by N. C. Oza and S. Russell at AISTATS 2001 as an extension of Breiman's Bagging algorithm to the online setting. Its central step is replacing bootstrap resampling with Poisson(1) weighting of each instance for each learner. The MOA framework (Bifet et al., 2010) is one software environment for streaming classifiers.
When to use it
Use Online Bagging when data arrives as a continuous stream and storing the full dataset is infeasible or not permitted, and when predictions must be updated as each new observation arrives. It is a reasonable choice when mild changes in the data distribution are expected and the base learners can be updated one instance at a time. Do not use it as a replacement for batch Random Forest on a fixed dataset of modest size, where cross-validated batch ensembles usually perform better. It is also a poor fit for streams with abrupt, severe drift unless a separate drift-detection mechanism is added.
Limitations and considerations
- On a static dataset, batch ensembles such as Random Forest can be more accurate than Online Bagging, because they can choose splits using all the data at once and can be tuned by cross-validation.
- Basic Online Bagging has limited resilience to severe concept drift; a dedicated drift detector such as ADWIN must be added externally.
- Poisson weighting adds variance to each learner's training, which may slow convergence on short streams.
- The ensemble of many incrementally grown trees is harder to inspect than a single decision tree.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Instances are processed one at a time and are not stored, so the memory needed for data does not grow with stream length, although the base learners' own structures can still grow.
- Poisson(1) weighting replaces bootstrap multiplicities, so each learner sees a different weighted view of the stream, which is the mechanism batch Bagging uses to reduce variance.
- Each base learner updates independently once it has received its weight, so the update work can be distributed across learners.
- The vote-based combination rule does not depend on the number of classes, so the same structure applies to multi-class problems.
Applications
- Classification on continuous data streams in which past records cannot be stored, where each new labelled instance can update the model directly.
- Settings with mild, gradual change in the data distribution, where incremental updating of the ensemble is preferred to periodic full retraining.
- Streaming problems in which prequential evaluation is the natural performance measure, such as models that are scored and updated on the same incoming data.
How it works
How it works
For each arriving instance, a weight k is drawn from a Poisson(1) distribution independently for every base learner. A weight of 0 means that learner skips the instance, and a weight of 2 means it learns from the instance twice. The Poisson(1) law is the limiting distribution of bootstrap multiplicities as the sample grows, which is why it stands in for resampling here.
Formula
k \sim \text{Poisson}(1)Each base learner, typically an incremental decision tree such as a Hoeffding Tree, receives the current instance with its assigned weight and updates its model immediately. The instance is then discarded, so the data itself is not stored. The learners' internal structures can still grow as the stream continues.
For a query instance, the outputs of the M base learners are combined by majority vote, which is the combination rule of the classification setting that the original framework addresses. Averaging the learners' outputs is a different rule and is not part of that classification scheme, so it should not be assumed for this method.
Formula
\hat{y} = \text{mode/mean of } M \text{ base learners}Common pitfalls
- Evaluating Online Bagging with a held-out test set created before training begins. Prequential (test-then-train) evaluation is the usual approach for streams, because each instance is used for prediction before it is used for training.
- Using too few base learners. With few learners the ensemble vote is noisy, especially early in the stream, so the ensemble size should be chosen by testing prequential accuracy at several sizes rather than assumed.
- Ignoring concept drift. Deploying Online Bagging on a drifting stream without drift detection can lead to gradual, unnoticed loss of accuracy.
- Judging the method by accuracy on a static benchmark against batch methods. The relevant comparison is accuracy over the instances seen on a streaming task.
- Using base learners that are not truly incremental, such as trees that are periodically retrained on stored data. This removes the memory and speed advantages that motivate the online framework.
Frequently asked questions
Why Poisson(1) specifically?
A Poisson distribution with mean 1 approximates the number of times an observation appears in a bootstrap sample of size n as n approaches infinity. Using Poisson(1) per instance per learner replicates this limiting behaviour, which is the basis of the online approximation.
How does Online Bagging relate to batch Random Forest?
Both build an ensemble of models trained on resampled versions of the data and combine their predictions. Batch Random Forest adds random feature selection at each split to make its trees more diverse. Online Bagging keeps the resampling idea but replaces bootstrap draws with Poisson(1) weights and updates each learner incrementally as instances arrive. The basic method does not add feature subsampling or drift handling, so it is the simpler starting point for streaming ensembles.
What base learner should I use?
The most common choice is the Hoeffding Tree (also called VFDT), the canonical incremental decision tree. It uses Hoeffding bounds to decide when enough data has been seen at a node to split, so the tree can be updated without storing past instances.
How many base learners do I need?
More learners reduce prediction variance but increase compute cost, and the effect is strongest early in the stream. No single ensemble size is established for all streams, so the value should be chosen by testing prequential accuracy at several sizes on your data.
How should I evaluate an Online Bagging classifier?
Use prequential evaluation: for each incoming instance, first predict its label, then update the model. Accuracy is computed as the running average of correct predictions. This avoids look-ahead bias and reflects the conditions of deployment on a stream.
Related methods
Sources
Oza, N. C., & Russell, S. (2001). Online bagging and boosting. In Proceedings of the Eighth International Workshop on Artificial Intelligence and Statistics (AISTATS 2001), pp. 105–112.
Open publication referenceBifet, A., Holmes, G., Kirkby, R., & Pfahringer, B. (2010). MOA: Massive Online Analysis. Journal of Machine Learning Research, 11, 1601–1604.
Open publication reference