I have two questions :
1/ What is the difference between model.evaluate() and model.predict() ?
2/ How does Keras calculate each one of them ?
model.evaluate predicts values and computes the loss and all attached metrics to the model over a given dataset. It returns a list containing the loss and metrics in one value.
model.predict only predicts the output of the model given inputs from a dataset. model.predict's inner workings are used inside model.evaluate, but the output of both is different, as they do not compute the same thing.
I am going for model.predict in beginning as model.predict is executed inside model.evaluate. model.predict only predict the output matrix on the basis of the test set as the model directs.
However, model.evaluate performs a model.predict operation internally and calculate the errors and accuracy depending on supplied parameters at the time of of model compilation. For example
model.compile(optimizer=OPTIMIZER, loss='categorical_crossentropy', metrics=['mse','mae','accuracy'])
Here I have asked model to supply output mse, mae, and accuracy. But it will not provide anything if we execute model.predictexcept output matrix, and then with respect to output we need to calculate error or accuracy. On the other hand, model.evaluate is a compact version which will calculate mse, mae, and accuracy all together and will provide a matrix like
[0.2498760256045422,0.015400263790238618,,0.9456890699253224]
It's similar like [mse, mae, accuracy]
Call is yours, anything you can pickup.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With