What's the difference between predict_proba and decision_function in scikit-learn?

后端 未结 2 517
余生分开走
余生分开走 2021-01-31 03:14

I\'m studying a scikit-learn example (Classifier comparison) and got confused with predict_proba and decision_function.

They plot the classific

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-31 03:41

    The latter, predict_proba is a method of a (soft) classifier outputting the probability of the instance being in each of the classes.

    The former, decision_function, finds the distance to the separating hyperplane. For example, a(n) SVM classifier finds hyperplanes separating the space into areas associated with classification outcomes. This function, given a point, finds the distance to the separators.

    I'd guess that predict_prob is more useful in your case, in general - the other method is more specific to the algorithm.

提交回复
热议问题