sklearn计算准确率和召回率

精确率和召回率

精确率和召回率具体介绍

from sklearn.metrics import classification_report,confusion_matrix

# 计算多分类的准确率和召回率,y为valid_loader为DataLoader类型
total_labels = valid_loader.dataset.y.tolist()
target_names = ['DDoS', 'SSH', 'Port', 'FTP', 'web']
precision_recall_report = classification_report(y_true=total_labels , y_pred=total_pred, target_names=target_names)
print('算法迭代时间:'+ str(end- start) +'\n算法精确率与召回率:')
print(precision_recall_report)

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