In this chapter, we presented the most basic ensemble learning method: voting. Although it is quite simple, it can prove to be effective and an easy way to combine many machine learning models. We presented hard and soft voting, a custom implementation for hard voting, and scikit-learn implementations for both hard and soft voting. Finally, we presented a way to analyze the ensemble's performance by plotting each base learner's errors using matplotlib. The chapter's key points are summarized below.
Hard voting assumes that the most voted class is the winner. Soft voting assumes that the class with the highest average probability is the winner. Soft voting requires that the base classifiers predict the probability of each class for every instance with a relatively high accuracy. Scikit-learn implements voting ensembles using the VotingClassifier class. An...