简体   繁体   English

scikit-learn中的predict_proba输出

[英]Output of predict_proba in scikit-learn

Suppose I have a data sample having two classes labeled 0 and 1. When I run output = clf.predict_proba(X_input) , each row in output consists of 2 columns corresponding to probability of each class. 假设我有一个数据样本有两个标记为0和1的类。当我运行output = clf.predict_proba(X_input)output每一行由2列组成,对应于每个类的概率。

Does the first column represent probability of class 0 or 1? 第一列是否代表0级或1级的概率? The predict_proba method of GradientBoostingClassier says: GradientBoostingClassier的predict_proba方法说:

"The class probabilities of the input samples. The order of the classes corresponds to that in the attribute classes_." “输入样本的类概率。类的顺序对应于属性classes_中的顺序。”

Does that mean that whichever, 0 or 1, is the first element of the data sample corresponds to the first column in the output of predict_proba ? 这是否意味着数据样本的第一个元素是0或1中哪一个对应于predict_proba输出中的第一列?

Generally a classifier will have an attribute named classes_ this will be populated upon fitting and store the classes. 通常,分类器将具有名为classes_的属性,这将在拟合和存储类时填充。 The order of the predict_proba method output will be the same as the order in this attribute. predict_proba方法输出的顺序与此属性中的顺序相同。

For example: 例如:

nb = MultinomialNM()
nb.fit(some_gender_data)
nb.classes_
array(['F', 'M'], dtype='<U1')

As far as I know all of the classifiers in sklearn have this attribute once fit. 据我所知,sklearn中的所有分类器都具有此属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Scikit-学习predict_proba的RandomForestClassifier输出 - Scikit-learn RandomForestClassifier output of predict_proba scikit-learn 中 predict 与 predict_proba 之间的差异 - Difference between predict vs predict_proba in scikit-learn 混淆scikit-learn svm的predict_proba的概率 - Confusing probabilities of the predict_proba of scikit-learn's svm Scikit-learn predict_proba给出了错误的答案 - Scikit-learn predict_proba gives wrong answers Scikit了解输出**predict_proba**和**predict.**的含义 - Scikit Learn the meaning of output **predict_proba** and **predict.** 如何在scikit-learn中获取与predict_proba一起使用的cross_val_predict中的类标签 - How to get classes labels from cross_val_predict used with predict_proba in scikit-learn Google Cloud ML引擎scikit学习预测概率&#39;predict_proba()&#39; - Google Cloud ML-engine scikit-learn prediction probability 'predict_proba()' 如何在MLlib中实现Scikit-Learn的predict_proba(X)等效项 - How to implement the predict_proba(X) -equivalent of Scikit-Learn in MLlib 如何从 scikit-learn predict_proba 中恢复输入分类符号? - How to recover input categorical symbols from scikit-learn predict_proba? 如何知道Scikit-learn中的predict_proba在返回数组中表示的类 - How to know what classes are represented in return array from predict_proba in Scikit-learn
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM