internalsGet Pro

Module 06 · Lesson 4 of 9Pro

The training loop: predict, measure, adjust

Level
Beginner
Topic
How models learn: losses and training
Reading time
13 min

When you finish this page you can

  1. Name the parts of one training step (forward pass, loss, gradient, update) and find each one in a NumPy or PyTorch loop.
  2. Count the steps, batches and epochs of a training run from the dataset size and the batch size.
  3. Write the standard PyTorch training loop with a check on held-out data after every epoch.
  4. Choose when a training run should stop, and say what would change that choice.
  1. Gradient descent: walking downhill to a better model14 min
  2. Stochastic and mini-batch gradient descent17 min
  3. Models as functions with learnable parameters12 min
  4. Loss functions: measuring how wrong a model is13 min

Seventy-four steps or three epochs?

is our example online store. Farah, an ML engineer, predicts how many orders each customer will place next month, so Joseph’s growth team can plan vouchers. She works on a notebook sample of 200,000 customers.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan