Skip to main content
 首页 » 编程设计

python之Hard Voting如何在scikit-learn的VotingClassifier中选出偶数个分类器的结果

2025年01月19日9zfyouxi

我在投票分类器中有两个分类器,它们都用于预测实例是 0 类还是 1 类。结果是使用硬投票(使用多数票)聚合的,但是我不确定 VotingClassifier 如何使用偶数个分类器做出决定。

请您参考如下方法:

它在 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.

因此如此处所述,如果出现平局,将使用字母顺序给出结果。