性能度量 2 precision_score 查准率

1、定义

计算分类结果的查准率

sklearn.metrics.precision_score(真实标记集合,预测)

性能度量 2 precision_score 查准率_第1张图片

2、代码

from sklearn.metrics import accuracy_score,precision_score
y_true=[1,1,1,1,1,0,0,0,0,0]
y_pred=[0,0,1,1,0,0,0,0,0,0]
print('准确率Accuracy Score:',accuracy_score(y_true,y_pred,normalize=True))
print('查准率Precision Score:',precision_score(y_true,y_pred))

3、结果

准确率Accuracy Score: 0.7
查准率Precision Score: 1.0

你可能感兴趣的:(人工智能,机器学习,sklearn,机器学习,python)