AM1054
AM1054

Reputation: 41

How does Hard Voting select a result with an even number of classifiers in a VotingClassifier in scikit-learn?

I have two classifiers in a Voting Classifier which are both being used to predict whether an instance is class 0 or class 1. The results are aggregated using hard voting (which uses a majority vote), however I am unsure how the VotingClassifier makes the decision with an even number of classifiers.

Upvotes: 3

Views: 1648

Answers (2)

RafiO
RafiO

Reputation: 123

One possible solution is to use confidence value to break the tie.

Upvotes: 0

Vivek Kumar
Vivek Kumar

Reputation: 36599

Its mentioned in the documentation here

In the cases of a tie, the VotingClassifier will select the class based on the ascending sort order. E.g., in the following scenario

classifier 1 -> class 2
classifier 2 -> class 1

the class label 1 will be assigned to the sample.

So as explained here, in case of a tie, the alphabetical order will be used to give out the result.

Upvotes: 2

Related Questions