Coding Now – Best AI & Full Stack Courses in Delhi NCR | 100% Placement
Limited Offer: Get 50% OFF on AI & Full Stack Courses
📞 Call Now: +91 9667708830
Back to Machine Learning Notes
Topic #1601

Ensemble Learning

Ensemble learning combines multiple models into one stronger predictor — the same "many imperfect opinions averaged together beat any single opinion" principle behind Random Forest, generalized to many more combination strategies and base model types.

The Four Main Families

FamilyCore IdeaFull Note
BaggingTrain many models in parallel on random data subsets, average/voteRandom Forest is the classic example
BoostingTrain models sequentially, each correcting the previous ones' mistakesAdaBoost, Gradient Boosting, XGBoost
StackingTrain a meta-model to learn how to best combine several different base models
VotingSimple, fixed combination rule (majority vote or averaged probabilities) across different algorithms

Bagging vs Boosting — The Fundamental Split

Bagging — parallel, independent Model 1 Model 2 Model 3 Average/Vote Boosting — sequential, dependent Model 1 Model 2 ... fits residual errors of Model 1

Bagging's models never see each other's output — they're purely independent, combined only at the end. Boosting's models are built one after another, each specifically targeting what the previous ones got wrong.

Why This Distinction Actually Matters

BaggingBoosting
Primarily reducesVarianceBias
Base learnersUsually deep, low-bias, high-variance treesUsually shallow, high-bias, low-variance "weak learners"
Parallelizable?Yes, fullyNo — inherently sequential
Overfitting riskLowerHigher, if trained for too many rounds

Practical Use Cases

  • Tabular data competitions and production systems, where XGBoost-family boosting is often the top-performing approach
  • Combining fundamentally different model types (a tree, a linear model, an SVM) via stacking or voting when they make different kinds of mistakes

Common Mistakes

  • Assuming any ensemble automatically beats a single well-tuned model — ensembles add real value when base models are reasonably accurate and make different kinds of errors; ensembling several near-identical, highly correlated models adds little.
  • Confusing bagging and boosting's failure modes — bagging is fairly overfitting-resistant by design, while boosting can overfit if run for too many rounds without regularization.

Interview Relevance

Q: "Why does boosting typically reduce bias while bagging reduces variance?" Boosting's base learners are deliberately weak (high bias) and trained sequentially to correct remaining errors — repeatedly targeting bias directly; bagging's base learners are typically already low-bias but high-variance, and averaging many independently-trained ones cancels out variance without touching bias much.

Practice Question

You have three different classifiers (a logistic regression, a decision tree, and an SVM) that each perform reasonably well but make different mistakes. Which ensemble family would you reach for first, and why?

Want to build ensemble models used in real ML competitions? CodingNow's Data Science course covers boosting and ensemble techniques with hands-on projects.

Related ML Notes

Want to go beyond the notes?

Join CodingNow's Machine Learning course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available
💬 Talk to Advisor
1
WhatsApp

Latest from Our Blog

Insights on AI, Data Science, Full Stack & Career

View All Articles →