chapter twelve

12 Combining models to maximize results: Ensemble learning

 

This chapter covers

  • What is ensemble learning.
  • Joining several weak classifiers to form a strong classifier.
  • Using bagging to join several classifiers together in a random way and obtain better results.
  • Using boosting to join classifiers in a smarter way.
  • Using AdaBoost to join several decision trees of depth 1.

After learning many interesting and very useful machine learning classifiers, a good question to ask is “Is there a way to combine them?”. Thankfully the answer is yes! In this chapter we learn several ways to build stronger classifiers by combining weaker ones. The methods we learn in this chapter are bagging and boosting. In a nutshell, bagging consists of constructing a few classifiers in a random way and putting them together.  Boosting, on the other hand, consists of building these models in a smarter way, by picking each model strategically to focus on the previous models’ mistakes. One of the most popular examples of boosting is the AdaBoost algorithm (Adaptive Boosting), which we study at the end of the chapter.

12.1  With a little help from our friends

12.2  Why an ensemble of learners? Why not just one really good learner?

12.3  Bagging - Joining some classifiers together to build a stronger classifier

12.3.1    Building random forests by joining several trees

12.3.2    Coding a random forest in sklearn

12.4  Boosting - Joining classifiers together in a smarter way to get a stronger classifier

12.4.1    A big picture of AdaBoost

12.4.2    A detailed (mathematical) picture of AdaBoost

12.4.3    Coding AdaBoost in Sklearn

12.5  XGboost - An extreme way to do gradient boosting

12.5.1    XGBoost similarity score

12.5.2    Building the learners

12.6  Applications of ensemble methods

12.7  Summary

12.8  Exercises

12.8.1    Exercise 12.1

12.8.2    Exercise 12.2