C2M3 Ex 6 hack: use num_epochs = 1

Greetings

If you set num_epochs = 1 and run the training loop, then run the cell with the training loop again, that will be equivalent to training it for 2 epochs because the model does not reset when the cell finishes execution.

This way, you can train for a few epochs using one value of the learning rate, then decrease its value and train more.

This also helps you stop when the validation loss stops decreasing to avoid overfitting.

I found this useful and I hope you will.

There is a standard method which does the same thing, it’s the Adam optimizer method.