Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

predict_proba() method of Keras model does not exist

I am trying to generate class scores by calling predict_proba() of Keras model, but it seems that this function does not exist! Is it deprecated because I see some examples in Google? I am using Keras 2.2.2.

like image 347
LearnToGrow Avatar asked Oct 04 '18 18:10

LearnToGrow


People also ask

What is predict_proba in Python?

The predict_proba() method The method accepts a single argument that corresponds to the data over which the probabilities will be computed and returns an array of lists containing the class probabilities for the input data points.


1 Answers

The predict_proba() and predict_classes() methods are not well-defined for models created using functional API (i.e. keras.models.Model()). That's because the models created using functional API may have multiple output layers each with different configurations. Therefore predicting probabilities in this case is not meaningful, even if your model outputs probabilities. The method you referred to, as well as predict_classes(), is only defined for Sequential models (i.e. keras.models.Sequential()).

like image 133
today Avatar answered Sep 22 '22 02:09

today