Machine Learning, FoundationsLesson 17 of 92

Module 2 · Linear models and the machinery of fitting

Regularisation: paying for large coefficients

In this lesson

  • 9 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 8 of 10 in this chapter

This chapter’s goalFit and diagnose a linear or logistic model end to end: compute its loss by hand on a handful of rows, tune the learning rate from the shape of the loss curve, state what a coefficient does and does not mean in the units of the data, and explain what ridge and lasso penalties change about the fitted parameters.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmWatch1:58Not available
Full audiobookNot availableNot available
The push each penalty exerts on a coefficient01201Coefficient size, wPush towards zero—— Lasso: gradient of |w| is constant– – Ridge: gradient of w² is 2wRidge’s push is 2w, so it fades as the coefficient shrinks and a small coefficient is never quitedriven to zero. Lasso’s push is the same at 0.001 as at 50, a constant, which is what carries smallcoefficients all the way to zero and holds them there.
Ridge's push is 2w, so it fades as the coefficient shrinks and a small coefficient is never quite driven to zero. Lasso's push is the same at 0.001 as at 50, a constant, which is what carries small coefficients all the way to zero and holds them there.

Figure

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 8Free · no account needed
Lesson steps

The idea in one sentence

Add the size of the coefficients to the loss, so the optimiser has to justify every unit of coefficient it spends with a matching reduction in error.

Text
ordinary:  minimise  sum of squared errors
ridge:     minimise  sum of squared errors + alpha * sum of w^2
lasso:     minimise  sum of squared errors + alpha * sum of |w|

That is the whole mechanism. alpha is the price. At alpha = 0 you are back to ordinary least squares. As alpha rises, coefficients shrink towards zero and the model gets simpler whether it likes it or not.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the How a Language Model Actually Works exam.

Stuck on something?Ask Funke, your AI tutor

How to cite: Addaly (2026) ‘Regularisation: paying for large coefficients’, in Machine Learning, Foundations. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/machine-learning-foundations/ridge-and-lasso (Accessed: 27 November 2026).