这篇教程python 如何把classification_report输出到csv文件写得很实用,希望能帮到您。 今天想把classification_report的统计结果输出到文件中,我这里分享一下一个简洁的方式: 我的pandas版本:pandas 1.0.3 代码:from sklearn.metrics import classification_reportreport = classification_report(y_test, y_pred, output_dict=True)df = pd.DataFrame(report).transpose()df.to_csv("result.csv", index= True) 是不是很简单,下面是我导出来的一个结果: 
补充:sklearn classification_report 输出说明 svm-rbf | 0.606 | precision recall f1-score support | 0.0 0.56 0.39 0.46 431 | 1.0 0.62 0.77 0.69 569 | avg / total 0.60 0.61 0.59 1000 | 最后一行是用support 加权平均算出来的,如0.59 = (431*0.46+569*0.69)/ 1000 以上为个人经验,希望能给大家一个参考,也希望大家多多支持51zixue.net。 在pytorch中计算准确率,召回率和F1值的操作 Pytorch训练网络过程中loss突然变为0的解决方案 |