internalsGet Pro

Module 06 · Lesson 7 of 9Pro

Regularization: L1, L2 and early stopping

Level
Intermediate
Topic
How models learn: losses and training
Reading time
17 min

When you finish this page you can

  1. Explain why memorising training customers needs large weights, and how a penalty on weight size makes that expensive.
  2. Work out by hand how an L2 penalty and an L1 penalty move one weight, and why only L1 reaches exactly zero.
  3. Choose a regularization strength from held-out loss, and set it in scikit-learn and PyTorch.
  4. Use early stopping as a regularizer alongside weight decay, and say when each one is enough on its own.
  1. Momentum, Adam and modern optimizers17 min
  2. Bayesian thinking: priors and posteriors16 min
  3. The training loop: predict, measure, adjust13 min
  4. Bias and variance: two kinds of error16 min
  5. Overfitting and underfitting13 min

A network that remembers customers one by one

is our example online store. Every Monday, Joseph’s growth team sends ₹100 vouchers to the 20,000 customers most likely to : to stop buying. Farah, an ML engineer, builds the model that ranks them, 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