Two weight vectors fit a training set equally well: and . Ridge adds the penalty and lasso adds , with . Compute both penalties for each vector. Which vector does each method prefer?
Supervised learning, Regularisation
Level L2 Elementary. Length Short. Nature Th+Mat Both.
What's being asked
Whether you can compute the L2 and L1 penalties of a weight vector and see how they treat "spread out" and "concentrated" weights differently.
Key idea
Ridge penalises the squared size of each weight, so one large weight costs much more than two half-size weights. Lasso penalises the absolute size, which is the same for both choices here. With equal fit, the method with the lower penalty wins.
Steps
- Ridge penalty of : , so the penalty is .
- Ridge penalty of : , so the penalty is .
- Lasso penalty of : , so . Of : , so .
- Conclude. Ridge prefers (0.45 against 0.9): it likes to share weight across features. Lasso sees a tie (0.3 each): it does not mind concentrating weight on one feature, which is the first hint of why lasso can set weights to exactly zero.
Common mistakes
- Forgetting to square in the ridge penalty. Without squaring you would get a tie, as in lasso.
- Taking absolute values for ridge or squares for lasso. Ridge is L2 (squares); lasso is L1 (absolute values).
- Reading the tie as "lasso never picks sparse weights". Here the fit was assumed equal; in real data the fit term breaks the tie.
How long your answer should be
About 2 minutes: four small sums and one sentence of interpretation.
Read this
Previous in Supervised learning: A linear regression model predicts monthly rent, in thousands of rupees, as , where is the flat's area in square feet and is the number of bedrooms. (a) What rent does it predict for a 600 sq ft flat with 2 bedrooms? (b) What does the number 3 mean? (c) Two flats both have 2 bedrooms but one is 100 sq ft larger. How much more rent does the model predict for it?
Next in Supervised learning: How do you derive the hard-margin SVM objective, and why is the margin , where is the weight vector?