Keras: How can I get the predicted probability of each test sample?

Created on 2 Mar 2016  路  6Comments  路  Source: keras-team/keras

I had used model.predict_proba(test), but the probability of each test smaple is not right, compared to the accuracy generated by model.evaluate(test). Am I wrong?

Most helpful comment

Hi the issue that I am having is that unlike lasagne which I used before Keras, predict_proba returned the probability of each possible outcome i.e. for the MNIST example if I passed in a single digit image I would get the probability of it being 0-9. Where as here I seem to be getting 1 always the predicted digit is. Any help would be appreciated

All 6 comments

Can you add some more details? Like examples of values you are seeing vs. the evaluate() results.

So, is there a way to get the predicted probability of each test sample ?

@jesuisnicolasdavid Of course, just using model.predict_proba(test)

Hi the issue that I am having is that unlike lasagne which I used before Keras, predict_proba returned the probability of each possible outcome i.e. for the MNIST example if I passed in a single digit image I would get the probability of it being 0-9. Where as here I seem to be getting 1 always the predicted digit is. Any help would be appreciated

I have two classes and trained the data for these two classes.
But I am not able to get the probability of the test data. predict, predict_class and predict_proba all are giving class index.
Please suggest for the same.

I have built model but i can鈥檛 get probability result.
In building model, i have softmax as a activation function.
I tried to get the probability result to use prediction function but i had not.
Please suggest for this.

Was this page helpful?
0 / 5 - 0 ratings