Ensemble Methods in Python
Learn to combine machine learning models in Python with voting, averaging, bagging, boosting and stacking, using scikit-learn, XGBoost, CatBoost and mlxtend.
Ensemble learning tackles a common modeling dilemma: rather than picking one model and hoping it is the best, you combine several so their strengths make up for each other’s weaknesses. You work through voting and averaging, the bootstrap idea behind random forests, gradual learning with boosting, and stacking, applying each method in Python to real datasets on app ratings, movie revenue and mushroom edibility.
What You Will Achieve
- Build voting and averaging ensembles and decide when soft or hard voting suits a classification task
- Train a bagged model in scikit-learn, read its out-of-bag score and tune its hyperparameters
- Fit AdaBoost and gradient boosting models with CatBoost and XGBoost for revenue prediction and sentiment analysis
- Stack several base models into one predictor using scikit-learn or the mlxtend library
Program Overview
Combining Models by Voting and Averaging
Makes the case for using several models at once and merges their predictions on Google Play, Pokémon and Game of Thrones data.
- Introduction to ensemble methods
- Voting and choosing the best model
- Averaging predictions
- Soft vs. hard voting
Bagging and Boosting with Decision Trees
Covers weak decision trees, bootstrap aggregating in scikit-learn, and gradual learning with adaptive and gradient boosting on movie and app review data.
- Bootstrap aggregating and out-of-bag scores
- Bagging hyperparameters on the UCI SECOM data
- AdaBoost and tree-based AdaBoost regression
- Gradient boosting flavors, including CatBoost and XGBoost
Stacking with scikit-learn and mlxtend
Closes with stacked ensembles for mushroom edibility and app ratings, built first in scikit-learn and then with mlxtend.
- The intuition behind stacking
- K-nearest neighbors as a base model
- Stacking classifiers and stacked regression
- Ensembling every method together
Certificate Awarded (Paid)
Job Outlook
Ensemble techniques are used in predictive modeling work across industries, such as rating, revenue and classification problems, and they are a regular tool in online machine learning competitions.
Good for: Python users who want hands-on practice with each main ensemble family and a feel for how the methods compare on the same problems.
Keep in mind: Hyperparameter tuning has its own lesson in the bagging chapter; the boosting and stacking chapters center on fitting the models and comparing their results.
Bottom line: A four-part tour of voting, bagging, boosting and stacking that comes back to the Google Play app data in three of its chapters.
Frequently Asked Questions
What data are the ensembles trained on?
The exercises draw on Google Play Store app ratings and reviews, Pokémon data, Game of Thrones character deaths, the UCI SECOM data, a movie database for revenue prediction, and a dataset of North American mushrooms for edibility.
Does the course compare different gradient boosting libraries?
Yes. The boosting chapter looks at several gradient boosting flavors, uses CatBoost to predict movie revenue, applies gradient boosting to sentiment analysis of app reviews, and ends with a contest between Light and Extreme gradient boosting.
How much of the bagging theory is covered?
The bagging chapter starts with why weak models can be useful, comparing restricted and unrestricted decision trees, then walks through bootstrapping and a first hand-built bagging attempt before moving to scikit-learn's BaggingClassifier.
Is stacking taught in more than one library?
Stacking is built first with scikit-learn and then with the mlxtend library. Both a classification task on mushroom edibility and a regression task on Google app ratings are used, and the final lesson brings the methods together.
User Reviews
Write your review
You must be logged in to post a review.
Reviews can only be posted by registered learners. Log in or create a free account, then you will return here to post.


There are no reviews yet.