Keras模型的predict_proba()方法不存在 [英] predict_proba() method of Keras model does not exist
问题描述
我试图通过调用Keras模型的predict_proba()
生成班级成绩,但似乎该功能不存在!是否因为我在Google中看到了一些示例而弃用了?我正在使用Keras 2.2.2.
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.
推荐答案
predict_proba()
和predict_classes()
方法
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()
).
这篇关于Keras模型的predict_proba()方法不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!