What is the difference between keras.evaluate() and keras.predict()?
model.predict的结果是模型的输出y_pred,而model.evaluate返回根据y_pred设置的metrics。
The model.evaluate function predicts the output for the given input and then computes the metrics function specified in themodel.compile and based on y_true and y_pred and returns the computed metric value as the output.
The model.predict just returns back the y_pred
Check here - the predict_loop used in model.predict keras-team/keras
and the test_loop used in model.evaluate keras-team/keras
They are same except the metrics computation part.
So if you use model.predict and then compute the metrics yourself, the computed metric value should turn out to be the same as model.evaluate
For example, one would use model.predict instead of model.evaluate in evaluating an RNN/ LSTM based models where the output needs to be fed as input in next time step as shown below.