loss - taoualiw/My-Knowledge-Base GitHub Wiki

Loss vs Accuracy

As part of the optimization algorithm, the error for the current state of the model must be estimated repeatedly. This requires the choice of an error function, conventionally called a loss function, that can be used to estimate the loss of the model so that the weights can be updated to reduce the loss on the next evaluation.

** To get good machine learning models, the most important quantity to keep track of is the difference between your training loss (printed during training) and the validation loss (printed once in a while when the RNN is run on the validation data (by default every 1000 iterations))

Scenarios

  • val_loss starts increasing, val_acc starts decreasing(means model is cramming values not learning)

  • val_loss starts increasing, val_acc also increases.(could be case of overfitting or diverse probability values in cases softmax is used in output layer)

  • val_loss starts decreasing, val_acc starts increasing(Correct, means model build is learning and working fine)

  • If your training loss is much lower than validation loss then this means the network might be overfitting. Solutions to this are to decrease your network size, or to increase dropout. For example you could try dropout of 0.5 and so on.

  • If your training/validation loss are about equal then your model is underfitting. Increase the size of your model (either number of layers or the raw number of neurons per layer)

the training loss is the average of the losses over each batch of training data. Because your model is changing over time, the loss over the first batches of an epoch is generally higher than over the last batches. On the other hand, the validation loss for an epoch is computed using the model as it is at the end of the epoch, resulting in a lower loss. The test loss is given by model.evaluate() at the end of last epoch

References:

⚠️ **GitHub.com Fallback** ⚠️