Bagging Algorithm

A Simple Explanation - By Varsha Saini

Bagging also known as Bootstrap Aggregation is an ensemble technique that uses multiple Decision Tree as its base model and improves the overall performance of the model. An example of a bagging algorithm is Random Forest.

Decision Tree has a major problem of Overfitting which can be resolved by a Bagging algorithm like Random Forest which considers multiple Decision Trees to solve the same problem and the output is aggregated causing variance to reduce and resolve Overfitting.

  • Every Decision Tree in Bagging Algorithm is given equal importance.
  • Each model is built independently i.e. there is no effect of one model on another.
  • Bagging algorithms reduced variance, not bias, hence suitable for high variance low bias problems.


It is the process of randomly selecting data with replacement i.e. the data which is already selected can be selected again.

Image Source

Steps to Implement Bagging

  1. Decide the number of Decision Trees.
  2. For every Decision Tree,
    1. Select samples without replacement.
    2. Select a subset of features.
  3. Implement all the models independent of each other.
  4. Aggregate the output from all the models.
Image Source

Advantages of Bagging

  1. Many weak learners are combined to become a strong learner.
  2. Resolves the Overfitting problem.

Disadvantages of Bagging

  1. Computationally expensive, since a number of models are trained.
  2. The final output can have some bias if the proper procedure is ignored.