Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created December 5, 2020 06:43
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 amankharwal/1bdf31a8e89e68071f38446b7ec8a1c0 to your computer and use it in GitHub Desktop.
Save amankharwal/1bdf31a8e89e68071f38446b7ec8a1c0 to your computer and use it in GitHub Desktop.
# Predictions
predictions = model.predict_classes(testing_images)
for i in range(len(predictions)):
if(predictions[i] >= 9):
predictions[i] += 1
predictions[:5]
#Output
#array([ 6, 8, 11, 14, 18])
# Precision, recall, f1-score for all the classes
from sklearn.metrics import classification_report, confusion_matrix
classes = ["Class " + str(i) for i in range(26) if i != 9]
print(classification_report(data_test['label'], predictions, target_names = classes))
# Confusion Matrix for the model predictions
cm = confusion_matrix(data_test['label'],predictions)
plt.figure(figsize=(12,7))
g = sns.heatmap(cm, cmap='Reds',annot=True,
fmt='')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment