For linear regression y^=∑iwixi with inverted dropout on the inputs (keep probability p), why does the expected squared loss equal the ordinary squared loss plus an adaptive L2 penalty? What is the closed-form solution, and what does the penalty say about how dropout regularises?

Deep learning, Training and regularisation
Level L5 Expert. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can marginalise (average out) the dropout noise with a bias–variance split, and read the result as data-dependent ridge regression.

Key idea

With y^=∑iwiximi/p and masks mi∼Bernoulli⁡(p):  Em[(y−y^)2]=(y−w⊤x)2+1−pp∑iwi2xi2. This is ridge regression (least squares plus a squared-weight penalty), with a per-weight penalty proportional to that feature's second moment.

Steps

  1. Write the noisy prediction: y^=∑iwiximi/p, with independent mi∼Bernoulli⁡(p).
  2. Mean: E[y^]=∑iwixi⋅p/p=w⊤x. Variance: Var⁡(y^)=∑iwi2xi2p2Var⁡(mi)=∑iwi2xi2 p(1−p)p2=1−pp∑iwi2xi2.
  3. Use E[(y−y^)2]=(y−E[y^])2+Var⁡(y^) (squared bias plus variance) to get (y−w⊤x)2+1−pp∑iwi2xi2.
  4. Sum over the data matrix X∈Rn×d (one row per example): ∥y−Xw∥2+1−pp w⊤Γw, where Γ=diag⁡(X⊤X), so Γii=∑nxni2.
  5. Closed form: setting the gradient to zero gives w=(X⊤X+1−pp Γ)−1X⊤y. Check the limits: p→1 gives least squares, and smaller p gives stronger shrinkage.
  6. Interpret: this is ridge regression after rescaling each feature to unit second moment. The penalty on wi scales with how much feature i varies, so the method is invariant to feature scale, and rare features (e.g. sparse words) are penalised little. For GLMs (generalised linear models) such as logistic regression the same holds approximately: a second-order expansion adds a curvature weight μn(1−μn) per example, where μn is the predicted probability (Wager, Wang and Liang, 2013).

Common mistakes

How long your answer should be

About a page; 8–10 minutes.

Last checked on 4 December 2026.

Read this

Previous in Deep learning: Consider an overparameterised linear model Xw=y with X∈Rn×d, d>n and rank⁡(X)=n, trained to minimise L(w)=12∥Xw−y∥22 by gradient descent from w0=0. How do you prove that if gradient descent converges to an interpolating solution, it must converge to the unique minimum-ℓ2-norm interpolator w∗=X⊤(XX⊤)−1y, and what changes if w0≠0?
Next in Deep learning: In a DDPM, why is the reverse-time conditional q(xt−1∣xt,x0) tractable when conditioned on x0 even though q(xt−1∣xt) is not, and how do you derive its mean μ~t(xt,x0) and variance β~t by completing the square in Bayes’ rule?