sklearn.metrics中的评估方法(accuracy_score,recall_score,roc_curve,roc_auc_score,confusion_matrix)

sklearn.metrics.accuracy_score(y_true, y_pred, normalize=True, sample_weight=None)

normalize:默认值为True,返回正确分类的比例;如果为False,返回正确分类的样本数


>>>import numpy as np

>>>from sklearn.metrics import accuracy_score

>>>y_pred = [0, 2, 1, 3]

>>>y_true = [0, 1, 2, 3]

>>>accuracy_score(y_true, y_pred)

0.5

>>>accuracy_score(y_true, y_pred, normalize=False)

2

 

你可能感兴趣的:(sklearn.metrics中的评估方法(accuracy_score,recall_score,roc_curve,roc_auc_score,confusion_matrix))