Model Training and EvaluationModel Training and Evaluation


The main goal of training a neural network is to reduce the error between model predictions and real data. To determine how well the model is doing its job, we need to somehow measure this error. This is the "quality of the model".

There are many different ways to calculate the quality of a model, and which method you choose depends on the problem you are trying to solve:

  1. Accuracy is simply the percentage of correct answers from all answers. For example, if your model correctly classified 90 out of 100 images, the accuracy would be 90%.
  2. Mean Squared Error (MSE) - often used in regression problems. Here we measure how much the model's predictions differ from the true values on average.
  3. Cross-entropy (Cross-entropy) - often used in classification problems. This is a measure of how well the predicted probabilities match the actual labels.
  4. And many other metrics...

Choosing the right metric is important because it determines how the model will "learn" and what it will consider a "good" result. If you use the wrong metric, the model may not learn the way you expect.

Our code uses the accuracy metric, which is one of the most basic and intuitive quality metrics for classification problems.


You can try experimenting with the number of epochs and learning rate before submitting the requested values to see how it affects the resulting accuracy. You can also see how increasing the number of epochs affects the time it takes to train the model.


Get the predictions of the trained model and evaluate the performance of the model using them:

  1. Training the model with 100 epochs and learning rate 0.5.
  2. Get predictions of the model for every example in the test set.
  3. Calculate accuracy of the model.

Everything was clear?

Section 2. Chapter 6
toggle bottom row