zoukankan      html  css  js  c++  java
  • Hard voting and Soft Voting

    Understanding different voting schemes

    Two different voting schemes are common among voting classifiers:

    • In hard voting (also known as majority voting), every individual classifier votes for a class, and the majority wins. In statistical terms, the predicted target label of the ensemble is the mode of the distribution of individually predicted labels.
    • In soft voting, every individual classifier provides a probability value that a specific data point belongs to a particular target class. The predictions are weighted by the classifier's importance and summed up. Then the target label with the greatest sum of weighted probabilities wins the vote.

    For example, let's assume we have three different classifiers in the ensemble that perform a binary ...

     ---------------------------

    Let's take a simple example to illustrate how both approaches work.

    Imagine that you have 3 classifiers (1, 2, 3) and two classes (A, B), and after training you are predicting the class of a single point.

    Hard voting

    Predictions:

    Classifier 1 predicts class A

    Classifier 2 predicts class B

    Classifier 3 predicts class B

    2/3 classifiers predict class B, so class B is the ensemble decision.

    Soft voting

    Predictions

    (This is identical to the earlier example, but now expressed in terms of probabilities. Values shown only for class A here because the problem is binary):

    Classifier 1 predicts class A with probability 99%

    Classifier 2 predicts class A with probability 49%

    Classifier 3 predicts class A with probability 49%

    The average probability of belonging to class A across the classifiers is (99 + 49 + 49) / 3 = 65.67%. Therefore, class A is the ensemble decision.


    So you can see that in the same case, soft and hard voting can lead to different decisions. Soft voting can improve on hard voting because it takes into account more information; it uses each classifier's uncertainty in the final decision. The high uncertainty in classifiers 2 and 3 here essentially meant that the final ensemble decision relied strongly on classifier 1.

    This is an extreme example, but it's not uncommon for this uncertainty to alter the final decision.

     -------------------

    Hard Voting Classifier : Aggregate predections of each classifier and predict the class that gets most votes. This is called as “majority – voting” or “Hard – voting” classifier.

    Soft Voting Classifier : In an ensemble model, all classifiers (algorithms) are able to estimate class probabilities (i.e., they all have predict_proba() method), then we can specify Scikit-Learn to predict the class with the highest probability, averaged over all the individual classifiers.

    Modle NameClass – 1 ProbabilityClass – 0 Probability
    Model – 1 0.49 0.51
    Model – 2 0.99 0.01
    Model – 3 0.49 0.51
    Averages 0.66 0.34



  • 相关阅读:
    java高级语法4:集合
    java高级语法3:异常和注解
    Java高级语法2:Lambda表达式
    VS编译时卡在正在从以下位置加载xxx.dll符号
    mysql中的外键
    localhost和127.0.0.1的区别
    添加依赖项
    代码版本控制——TFS
    优化版冒泡排序
    visual studio vode 汉化
  • 原文地址:https://www.cnblogs.com/emanlee/p/13466950.html
Copyright © 2011-2022 走看看