Model Evaluation

How can you evaluate your model evaluation using Keras?

The evaluate method

Evaluation is a process for checking whether the model is the best fit for the given dataset.

πŸ“ NoteL: Ideally, we make a train and validation split of the dataset. Then, check the accuracy of the model on the validation set to examine how well the model has learned the data representation. However, if we have not made the initial split, check the training accuracy. You will learn about model validation when fine-tuning the model here.

Keras provides the evaluate function for model evaluation.

Arguments for the evaluate method

It takes the data and the label.

It returns a list with two values. Namely, loss and the metrics defined in the compile method. If metrics are not defined, it returns only loss.

πŸ“ Note: In case of classification, define metrics=[accuracy] in the compile method. The evaluate method thus returns a list with two values. The first value will be the loss of the model on the dataset and the second will be the accuracy of the model on the dataset.

πŸ“ Note: We are only interested in reporting the accuracy. Ignore the loss value.

Get hands-on with 1200+ tech skills courses.