22.02.2024 Views

Daniel Voigt Godoy - Deep Learning with PyTorch Step-by-Step A Beginner’s Guide-leanpub

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Sure, in the real world, you’ll never get a pretty bowl like that. But our conclusion

still holds:

1. Always standardize (scale) your features.

2. DO NOT EVER FORGET #1!

Step 5 - Rinse and Repeat!

Now we use the updated parameters to go back to Step 1 and restart the process.

Definition of Epoch

An epoch is complete whenever every point in the training set

(N) has already been used in all steps: forward pass, computing

loss, computing gradients, and updating parameters.

During one epoch, we perform at least one update, but no more

than N updates.

The number of updates (N/n) will depend on the type of gradient

descent being used:

• For batch (n = N) gradient descent, this is trivial, as it uses all

points for computing the loss—one epoch is the same as one

update.

• For stochastic (n = 1) gradient descent, one epoch means N

updates, since every individual data point is used to perform

an update.

• For mini-batch (of size n), one epoch has N/n updates, since a

mini-batch of n data points is used to perform an update.

Repeating this process over and over for many epochs is, in a nutshell, training a

model.

What happens if we run it over 1,000 epochs?

Step 5 - Rinse and Repeat! | 55

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!