Solve the lasso one coordinate at a time and trace its regularization path. The objective (no intercept; assume the data are centered) is
Implement:
soft_threshold(x, delta) , element-wise.lasso_cd(X, y, lam, w0=None, tol=1e-10, max_sweeps=10000): cyclic coordinate descent. Start from w0 (a copy) or zeros. In each sweep visit in order and set to the exact minimizer of over with the other coordinates held at their current values. Stop after the first sweep whose largest absolute coordinate change is below tol, or after max_sweeps sweeps. Return (w, n_sweeps).lasso_path(X, y, n_lambdas=20, eps=1e-3): let and use the grid for (from down to ). Solve each problem with lasso_cd, warm-starting from the previous solution (the first from zeros). Return (lambdas, W) with W of shape (n_lambdas, D).Every column of X is nonzero.