如何使用scikit-learn访问每个类的支持量,使用多类分类?

时间:2015-03-29 20:21:35

标签: machine-learning scikit-learn

我可以使用以下代码使用scikit-learn打印分类报告:

def predict_and_report_test(self, prediction_model):
    print(prediction_model.algorithm + ' Test')
    prediction_model.model = prediction_model.model.fit(self.X_train,  self.y_train).predict(self.X_test)
    print(classification_report(self.y_test, prediction_model.model,  target_names=None))

此代码给出了以下输出:

enter image description here

问题是classification_report以字符串形式返回此信息,所以我的问题是:是否有scikit learn提供的任何简单方法来访问每个类的支持并可能将它们存储在数组中,因此它们可用于绘制每个班级的支持图表?

1 个答案:

答案 0 :(得分:1)