所以我理解这个函数的工作原理是,它将一个表一分为二,然后比较这两个值以确定预测率
假设我有一张表:
Column1 Column2 Column3 Column4 Column5
3 2 2 43 0
1 2 2 23 1
5 5 2 56 1
4 3 2 13 0
6 1 2 11 1
"Column 5" is label 0 or 1我知道前3行是100%正确的,因为我手动为它分配了标签,但是第4行和第5行是使用随机森林分类器标记的。我想看看预测率是多少。
我想用classification_report(y_true,y_pred,target_names=target_names),我的"y_true","y_pred“是什么?我假设target_names = 0,1
发布于 2019-03-15 03:01:41
y_true是样本的真实标签,y_pred是我在模型中做出的预测。target_name允许您为类标签指定自定义名称
classification_report报告了模型的精确度、召回率、F1得分和支持。
示例如sklearn https://scikit-learn.org/stable/modules/generated/sklearn.metrics.classification_report.html中所示
from sklearn.metrics import classification_report
y_true = [0, 1, 2, 2, 2]
y_pred = [0, 0, 2, 2, 1]
print(classification_report(y_true, y_pred, target_names=target_names))例如,类0的精度是真阳性/真阳性+假阳性,即1/2 = 0.5
https://stackoverflow.com/questions/55169927
复制相似问题