Voting classifier

A very interesting ensemble solution is offered by the class VotingClassifier, which isn't an actual classifier but a wrapper for a set of different ones that are trained and evaluated in parallel. The final decision for a prediction is taken by majority vote according to two different strategies:

  • Hard voting: In this case, the class that received the major number of votes, Nc(yt), will be chosen:
  • Soft voting: In this case, the probability vectors for each predicted class (for all classifiers) are summed up and averaged. The winning class is the one corresponding to the highest value:

Let's consider a dummy dataset and ...

Get Machine Learning Algorithms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.