Could someone explain why the loss returned is different than the loss printed during the evaluation?

They are the same in the Tensorflow documentation https://www.tensorflow.org/guide/keras/train_and_evaluate


results = model.evaluate(test_data, test_target, verbose=2)
print("test loss, test acc:", results)


45/1 - 0s - loss: 1.2592 - mae: 0.7602
test loss, test acc: [1.05335361427731, 0.76020277]

The model.evaluate function predicts the output for the given input and then computes the metrics function specified in the model.compile.Based on y_true and y_pred and returns the computed metric value as the output.

You can use model.metrics_names property of your model to find out what each of those values corresponds to.

  • $\begingroup$ I have the following metrics ['loss', 'mae'] but it doesnt explain why the loss printed in verbose is different than the loss in the returned object $\endgroup$ – Marc Aug 25 '20 at 12:38
  • $\begingroup$ check this link $\endgroup$ – Shiv Aug 25 '20 at 17:01
  • $\begingroup$ I don't think it's related, my issue is not the different between evaluate and predict but between the loss printed with verbose by evaluate and the loss returned by evaluate $\endgroup$ – Marc Aug 27 '20 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.