10000 FIX : get rid of coef_init in Lasso in dict learning · scikit-learn/scikit-learn@faddb45 · GitHub
[go: up one dir, main page]

Skip to content

Commit faddb45

Browse files
committed
FIX : get rid of coef_init in Lasso in dict learning
1 parent 4fcb24c commit faddb45

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

sklearn/decomposition/dict_learning.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,9 @@ def _sparse_encode(X, dictionary, gram, cov=None, algorithm='lasso_lars',
106106
elif algorithm == 'lasso_cd':
107107
alpha = float(regularization) / n_features # account for scaling
108108
clf = Lasso(alpha=alpha, fit_intercept=False, precompute=gram,
109-
max_iter=max_iter)
110-
clf.fit(dictionary.T, X.T, coef_init=init)
109+
max_iter=max_iter, warm_start=True)
110+
clf.coef_ = init
111+
clf.fit(dictionary.T, X.T)
111112
new_code = clf.coef_
112113

113114
elif algorithm == 'lars':

sklearn/linear_model/coordinate_descent.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ def __init__(self, alpha=1.0, l1_ratio=0.5, fit_intercept=True,
552552
self.positive = positive
553553
self.intercept_ = 0.0
554554

555-
def fit(self, X, y, coef_init=None):
555+
def fit(self, X, y):
556556
"""Fit model with coordinate descent.
557557
558558
Parameters
@@ -563,10 +563,6 @@ def fit(self, X, y, coef_init=None):
563563
y : ndarray, shape = (n_samples,) or (n_samples, n_targets)
564564
Target
565565
566-
coef_init : ndarray of shape n_features or (n_targets, n_features)
567-
The initial coefficients to warm-start the optimization
568-
WARNING : ignored and will be deprecated in 0.15
569-
570566
Notes
571567
-----
572568

0 commit comments

Comments
0 (0)
0