Код: Выделить всё
threshold = 0.5
y_pred_prob = cnn_model.predict(x_test_pad)
y_pred = (y_pred_prob > threshold).astype(int).flatten()
from sklearn.metrics import confusion_matrix, ConfusionMatrixDisplay
con_mat = confusion_matrix(y_test, y_pred_class, labels = [0,1])
disp = ConfusionMatrixDisplay(confusion_matrix = con_mat, display_labels = [0,1])
disp.plot(cmap='Blues')
plt.show()
Неправильная матричная классификация
Подробнее здесь: https://stackoverflow.com/questions/791 ... dict-model