internalsGet Pro

Module 04 · Lesson 6 of 11Pro

Stochastic and mini-batch gradient descent

Level
Intermediate
Topic
Calculus and optimization for machine learning
Reading time
17 min

When you finish this page you can

  1. Explain why the gradient of a random mini-batch is an unbiased but noisy estimate of the full gradient, and how its noise shrinks with batch size.
  2. Choose a batch size by weighing noise per step against cost per step, and say what would change the choice.
  3. Train with epochs and shuffling, and tell normal noise in a loss curve from a real problem such as unshuffled data.
  4. Adjust the learning rate when the batch size changes, and name where that rule stops working.

Builds on 3 lessons

Start with lesson 414 min
  1. Gradient descent: walking downhill to a better model14 min
  2. Learning rate: step size and stability14 min
  3. PyTorch tensors: shapes, axes and operations14 min

Every step reads all 200,000 customers

is our example online store. Farah, an ML engineer, is predicting how many orders each customer will place next month, so Joseph’s growth team can plan vouchers. Her model now uses 40 features per customer, on the 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