Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find wrong prediction cases in test set (CNNs using Keras)

I'm using MNIST example with 60000 training image and 10000 testing image. How do I find which of the 10000 testing image that has an incorrect classification/prediction?

like image 623
user3796320 Avatar asked Sep 02 '16 21:09

user3796320


People also ask

How do you evaluate a CNN model?

Evaluating models can be streamlined through a couple of simple methods that yield stats that you can reference later. If you've ever read a research paper - you've heard of a model's accuracy, weighted accuracy, recall (sensitivity), specificity, or precision.

What is Predict_classes?

predict_class will return the index of the class having maximum value. For example, if cat is 0.6 and dog is 0.4, it will return 0 if the class cat is at index 0)


1 Answers

Simply use model.predict_classes() and compare the output with true labes. i.e:

incorrects = np.nonzero(model.predict_class(X_test).reshape((-1,)) != y_test)

to get indices of incorrect predictions

like image 128
S.Mohsen sh Avatar answered Sep 30 '22 21:09

S.Mohsen sh