Is it possible to get prediction accuracy after call model.predict_classes()?

Viewed 2010

I'm new to python neural networks. I used ml.net in the past. There was easy to take accuracy of each predicted example f.e -> my model recognized bike on photo with acc = 60%.

Now I need to make similar thing in python. I'm using keras and tensorflow.

This is how I make my prediction:

predict = model.predict_classes(data)

It returns predicted class but how to get accuracy of this prediction?

3 Answers

I think what you're looking for is the model.predict(<np.array>)

If your task is classification and you are doing multi-class classification, remember to use softmax at the end to get the correct probabilities.

I think you are looking for probability of each class if it's true so you can use: "predict_proba" for example if your feature victor is "data" in sklearn it would be:

 pro=model.predict_proba(data)

Which pro is an array contain probabilities of each class. In your case for example 60% bike, 30 % car and so on.

Related