mathurinm / celer

Fast solver for L1-type problems: Lasso, sparse Logisitic regression, Group Lasso, weighted Lasso, Multitask Lasso, etc.
https://mathurinm.github.io/celer/
BSD 3-Clause "New" or "Revised" License
198 stars 32 forks source link

BUG more than one iteration done when fitting with alpha > alpha_max #252

Closed mathurinm closed 1 year ago

mathurinm commented 2 years ago

Probably not the most frequent case, and not very harmful, but writing it here for future reference:

import libsvmdata
from celer import Lasso
import numpy as np
from numpy.linalg import norm

X, y = libsvmdata.fetch_libsvm("rcv1.binary")
alpha_max = norm(X.T @ y, ord=np.inf) / len(y)

clf = Lasso(alpha_max * 2, verbose=1, fit_intercept=False)
clf.fit(X, y)
print(norm(clf.coef_))
assert clf.n_iter_ == 1