class celer.Lasso(alpha=1.0, max_iter=100, gap_freq=10, max_epochs=50000, p0=10, verbose=0, tol=0.0001, prune=0, fit_intercept=True)

Lasso scikit-learn estimator based on Celer solver

The optimization objective for Lasso is:

(1 / (2 * n_samples)) * ||y - X w||^2_2 + alpha * ||w||_1

alpha : float, optional

Constant that multiplies the L1 term. Defaults to 1.0. alpha = 0 is equivalent to an ordinary least square. For numerical reasons, using alpha = 0 with the Lasso object is not advised.

max_iter : int, optional

The maximum number of iterations (subproblem definitions)

gap_freq : int

Number of coordinate descent epochs between each duality gap computations.

max_epochs : int

Maximum number of CD epochs on each subproblem.

p0 : int

First working set size.

tol : float, optional

The tolerance for the optimization: the solver runs until the duality gap is smaller than tol or the maximum number of iteration is reached.

verbose : bool or integer

Amount of verbosity.

prune : 0 | 1, optional

Whether or not to use pruning when growing working sets.

fit_intercept : bool

Whether or not to fit an intercept.

See also

celer_path, LassoCV


[R11]M. Massias, A. Gramfort, J. Salmon “Celer: Dual Extrapolation for Faster Lasso Solvers”, ICML 2018, https://arxiv.org/abs/1802.07481


>>> from celer import Lasso
>>> clf = Lasso(alpha=0.1)
>>> clf.fit([[0, 0], [1, 1], [2, 2]], [0, 1, 2])
Lasso(alpha=0.1, gap_freq=10, max_epochs=50000, max_iter=100,
p0=10, prune=0, tol=1e-06, verbose=0)
>>> print(clf.coef_)
[0.85 0.  ]
>>> print(clf.intercept)


sparse_coef_ sparse representation of the fitted coef_
coef_ (array, shape (n_features,)) parameter vector (w in the cost function formula)
intercept_ (float) constant term in decision function.
n_iter_ (int) number of subproblems solved by celer to reach the specified tolerance.
__init__(alpha=1.0, max_iter=100, gap_freq=10, max_epochs=50000, p0=10, verbose=0, tol=0.0001, prune=0, fit_intercept=True)


__init__([alpha, max_iter, gap_freq, …])
fit(X, y[, check_input]) Fit model with coordinate descent.
get_params([deep]) Get parameters for this estimator.
path(X, y, alphas, **kwargs) Compute Lasso path with Celer.
predict(X) Predict using the linear model
score(X, y[, sample_weight]) Returns the coefficient of determination R^2 of the prediction.
set_params(**params) Set the parameters of this estimator.
Fork me on GitHub