internalsGet Pro

Module 04 · Lesson 9 of 11Pro

Lagrange multipliers: the best answer within limits

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

When you finish this page you can

  1. Find the best answer under one fixed limit by making the gradient of the goal parallel to the gradient of the limit.
  2. Write the Lagrangian for a budget problem, solve its equations by hand and check the answer in NumPy.
  3. Read the multiplier as the price of the limit, and use it instead of the average return to judge a bigger budget.
  4. Connect a weight budget to L2 regularization: the penalty strength is the multiplier.

Builds on 2 lessons

Start with lesson 314 min
  1. Gradients: derivatives with many inputs14 min
  2. Gradient descent: walking downhill to a better model14 min

Twenty thousand vouchers, two kinds of customer

is our example online store. Every Monday, Joseph’s growth team emails 20,000 vouchers of ₹100 to the customers its model says are about to stop buying. Farah, an ML engineer, owns that model and the list it produces.

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