How does the penalty hyperparameter lambda relate to the variance of the Bayesian prior?

Quick Overview

Asks how the ridge or lasso penalty strength connects to the spread of a Bayesian prior on the weights. Tests the MAP derivation from a Gaussian likelihood, the limiting cases, the link between a Laplace prior and L1, and how loss conventions and feature scaling change the constant.

How does the penalty hyperparameter lambda relate to the variance of the Bayesian prior?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

Regularized linear regression adds a penalty $\lambda \|w\|^2$ (ridge) or $\lambda \|w\|_1$ (lasso) to the squared-error loss. How does the penalty hyperparameter $\lambda$ relate to the variance of the Bayesian prior on the weights? ```hint Write the log-posterior Take the negative log of a Gaussian likelihood times a zero-mean Gaussian prior on the weights. Which terms depend on $w$? ``` ```hint Match the ridge objective Rescale the negative log-posterior so its data term matches the ridge objective exactly, then read off the coefficient on $\|w\|^2$. ``` ### What a Strong Answer Covers - The MAP derivation from a Gaussian likelihood and a Gaussian prior - The resulting formula linking $\lambda$, the noise variance and the prior variance - The limiting cases and the intuition behind the ratio - The Laplace prior and its link to the L1 penalty - How loss conventions, sample size and feature scaling change the constant ### Follow-up Questions - For a Laplace prior, is $\lambda$ inversely proportional to the prior's variance or to something else? - Under scikit-learn's `Lasso` objective, how does the penalty that matches a fixed prior change with the number of samples? - How would you estimate the prior variance from the data instead of cross-validating $\lambda$? - Ridge returns the MAP estimate. What does the full posterior give you that the point estimate does not?

Overview: Asks how the ridge or lasso penalty strength connects to the spread of a Bayesian prior on the weights. Tests the MAP derivation from a Gaussian likelihood, the limiting cases, the link between a Laplace prior and L1, and how loss conventions and feature scaling change the constant.

General logo
General
Nov 24, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

Regularized linear regression adds a penalty λ∥w∥2\lambda \|w\|^2 (ridge) or λ∥w∥1\lambda \|w\|_1 (lasso) to the squared-error loss. How does the penalty hyperparameter λ\lambda relate to the variance of the Bayesian prior on the weights?

What a Strong Answer Covers Guidance

  • The MAP derivation from a Gaussian likelihood and a Gaussian prior
  • The resulting formula linking λ\lambda , the noise variance and the prior variance
  • The limiting cases and the intuition behind the ratio
  • The Laplace prior and its link to the L1 penalty
  • How loss conventions, sample size and feature scaling change the constant

Follow-up Questions Guidance

  • For a Laplace prior, is λ\lambda inversely proportional to the prior's variance or to something else?
  • Under scikit-learn's Lasso objective, how does the penalty that matches a fixed prior change with the number of samples?
  • How would you estimate the prior variance from the data instead of cross-validating λ\lambda ?
  • Ridge returns the MAP estimate. What does the full posterior give you that the point estimate does not?