def evaluate_prediction(y_true, y_pred):
""" evaluate prediction performance, given the ground truth
:param y_true: correct target values
:param y_pred: predicted values
:return: confusion matrix, tp, tn, fp, fn precision, recall, F-score, and support
"""
cm = confusion_matrix(y_true, y_pred)
precision, recall, fscore, support = precision_recall_fscore_support(y_true, y_pred)
return cm, tp_tn_fp_fn(cm), precision, recall, fscore, support
评论列表
文章目录