Skip to content
nonconvexcard

Implement ISTA and verify the lasso rate

CodingAdvanced⏱ 3 hoursHigh-Dim Statisticslassoistaimplementationrate verification

Problem

Implement proximal gradient descent (ISTA) for the lasso and use it to verify empirically that the estimation error scales like slog⁡p/n\sqrt{s\log p/n}.

  1. Generate sparse β⋆\beta^\star with ss non-zeros and Gaussian design; solve with λ=2σ2log⁡p/n\lambda = 2\sigma\sqrt{2\log p/n}.
  2. Sweep nn at fixed s,ps,p and fit the slope of log⁡∥β^−β⋆∥2\log\|\hat\beta-\beta^\star\|_2 against log⁡n\log n.
  3. Sweep pp at fixed n,sn,s and check the log⁡p\sqrt{\log p} dependence.
  4. Compare with ridge regression at its best λ\lambda, for sparse and for dense β⋆\beta^\star.

Implement it, then check the implementation against something you can verify independently.

Write it

Solve it here5 tests · Python runs in your browser
⌘/Ctrl + ↵ to run · limit 45s · draft saved in this browser
5 tests will run against your code. The first run downloads the Python runtime — several megabytes, once per browser.

Solution

Opening this before you have a real attempt on paper is the fastest way to feel like you understand something you cannot reproduce.

Related problems

All problems
SolvedProblemFieldTypeDifficultyTime
Derive the soft-thresholding operatorHigh-Dim StatisticsProofIntermediate30 min
Implement backpropagation from scratch runDeep LearningCodingIntermediate3 hours
Implement kernel ridge regression runClassical MLCodingIntermediate1 hour
Implement multi-head attention from scratch runDeep LearningCodingIntermediate3 hours
Implement power iteration and verify the convergence rate runFoundationsCodingIntermediate1 hour