What is the difference between predict
and predict_class
functions in keras?
Why does Model
object don't have predict_class
function?
What is the difference between predict
and predict_class
functions in keras?
Why does Model
object don't have predict_class
function?
predict
will return the scores of the regression andpredict_class
will return the class of your prediction. Although it seems similar there are some differences:Imagine you are trying to predict if the picture is a dog or a cat (you have a classifier):
predict
will return you: 0.6 cat and 0.2 dog (for example).predict_class
will return you catNow image you are trying to predict house prices (you have a regressor):
predict
will return the predicted pricepredict_class
will not make sense here since you do not have a classifierTL:DR: use
predict_class
for classifiers (outputs are labels) and usepredict
for regressions (outputs are non discrete)Hope it helps!
predict_classes method is only available for the Sequential class but not for the Model class You can check this answer