In my code I’m plotting the accuracy curve plot and the confusion matrix heat map. However: 1- I’m getting both plots on one (picture below) 2- Why is the number apering this way ? In my heat map, I need the numbers and the percentages.
The code
JavaScript
x
15
15
1
display = confusion_matrix(y_test, y_pred)
2
print(display)
3
sns.heatmap(display, annot=True,cbar_kws={'format':PercentFormatter()}, cmap='Blues')
4
5
"""
6
Plot of Model Accuracy on Train and Validation Datasets
7
"""
8
plt.plot(history.history['accuracy'])
9
plt.plot(history.history['val_accuracy'])
10
plt.title('model accuracy')
11
plt.ylabel('accuracy')
12
plt.xlabel('epoch')
13
plt.legend(['train', 'val'], loc='upper left')
14
plt.show()
15
Advertisement
Answer
After this row:
JavaScript
1
2
1
sns.heatmap(display, annot=True,cbar_kws={'format':PercentFormatter()}, cmap='Blues')
2
add a new row:
JavaScript
1
2
1
plt.show()
2