合肥网站推广公司,校园网站开发需求文字,多语言网站开发公司,网站开发毕设设计论文classification_report()是python在机器学习中常用的输出模型评估报告的方法。
classification_report()函数介绍 classification_report()语法如下#xff1a;classification_report( y_true, y_pred, labelsNone, …classification_report()是python在机器学习中常用的输出模型评估报告的方法。
classification_report()函数介绍 classification_report()语法如下classification_report( y_true, y_pred, labelsNone, target_namesNone, sample_weightNone, digits2, output_dictFalse, zero_division“warn” )
使用示例 from sklearn.metrics import classification_report
# 测试集真实数据 y_test [1, 2, 3, 1, 2, 3, 1, 2, 3] # 预测结果 y_predicted [1, 2, 3, 3, 2, 1, 3, 2, 3] 以这两行数据为例不难直接看出 预测中预测了
2次1标签成功1次1标签预测的准确率率为0.53次2标签成功3次2标签预测的准确率为1.04次3标签成功2次3标签预测的准确率为0.5
print(classification_report(y_test, y_predicted)) 也可以加上target_names参数效果如下 如图左边显示出了新传入的标签名。 print(classification_report(y_test, y_predicted, target_names[a类, b类, c类]))