[英]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.