scikit-learn 中的 predict_proba 和 decision_function 有什么区别? [英] What's the difference between predict_proba and decision_function in scikit-learn?
问题描述
我正在研究 scikit-learn 示例(分类器比较) 并与 predict_proba
和 decision_function
混淆.
I'm studying a scikit-learn example (Classifier comparison) and got confused with predict_proba
and decision_function
.
他们通过使用 Z = clf.decision_function()
或 Z = clf.predict_proba()
绘制轮廓来绘制分类结果.
They plot the classification results by drawing the contours using either Z = clf.decision_function()
, or Z = clf.predict_proba()
.
这两者有什么区别?是不是每种分类方法都将两者之一作为分数?
What's the differences between these two? Is it so that each classification method has either of the two as score?
哪个更适合解释分类结果,我应该如何从两者中选择?
Which one is more proper to interpret the classification result and how should I choose from the two?
推荐答案
后者,predict_proba
是一种(软)分类器的方法,输出实例在每个类中的概率.
The latter, predict_proba
is a method of a (soft) classifier outputting the probability of the instance being in each of the classes.
前者,decision_function
,找到到分离超平面的距离.例如,a(n) SVM 分类器找到将空间分成与分类结果相关联的区域的超平面.这个函数,给定一个点,找到到分隔符的距离.
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.
我猜想 predict_prob
对您的情况更有用,一般来说 - 另一种方法更特定于算法.
I'd guess that predict_prob
is more useful in your case, in general - the other method is more specific to the algorithm.
这篇关于scikit-learn 中的 predict_proba 和 decision_function 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!