Get Confusion Matrix From a Keras Multiclass Model

Your input to confusion_matrix must be an array of int not one hot encodings.

matrix = metrics.confusion_matrix(y_test.argmax(axis=1), y_pred.argmax(axis=1))

Leave a Comment