Skip to content

Instantly share code, notes, and snippets.

@bpatra
Last active December 5, 2020 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bpatra/fd302a09afdb54c57b95a3908059cf62 to your computer and use it in GitHub Desktop.
Save bpatra/fd302a09afdb54c57b95a3908059cf62 to your computer and use it in GitHub Desktop.
confusionreport.py
from sklearn.metrics import classification_report, confusion_matrix
TEST_SIZE=200
target_names = ['J', 'L']
Y_pred = model_convenet_ad_hoc.predict_generator(test_generator, TEST_SIZE)
Y_pred = Y_pred.flatten()
y_pred_class = np.where(Y_pred > 0.5, 1, 0)
print('Classification Report')
print(classification_report(test_generator.classes, y_pred_class, target_names=target_names))
print('Confusion Matrix')
plot_confusion_matrix(confusion_matrix(test_generator.classes, y_pred_class),target_names)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment