quantlab.model.predefined.linear.lasso_gram#

quantlab.model.predefined.linear.lasso_gram(xtx, xty, n, alpha, max_iter=10000, tol=1e-10)[source]#

scikit-learn’s Lasso coefficients from the Gram matrix, by coordinate descent.

Minimises |y - Xw|^2 / (2n) + alpha |w|_1.

Examples

>>> lasso_gram(np.diag([4.0, 4.0]), np.array([4.0, 0.2]), n=4, alpha=0.1).round(3).tolist()
[0.9, 0.0]