def evaluate(y_test, y_test_proba, nb_classes, path):
from riddle import roc # here so np can be seeded before run_pipeline() call
y_pred = [np.argmax(p) for p in y_test_proba]
print('Confusion matrix:')
print(confusion_matrix(y_test, y_pred))
print()
print('Classification report:')
print(classification_report(y_test, y_pred, digits=3))
print('ROC AUC values:')
roc_auc, fpr, tpr = roc.compute_roc(y_test, y_test_proba,
nb_classes=nb_classes)
roc.save_plots(roc_auc, fpr, tpr, nb_classes=nb_classes, path=path)
for l, r in roc_auc.items():
print(' {}: {:.5f}'.format(l, r))
print()
# ---------------------------- PUBLIC FUNCTIONS ------------------------------ #
评论列表
文章目录