Skip to content

Commit f977346

Browse files
author
Fabian Pedregosa
committed
FIX: bug in elasticnet with precompute not being updated correctly.
And added a remark on updating the Gram matrix. This was triggered by tests inside dict_learning, probably the last commit made this visible. Thus I'm not adding more tests.
1 parent 0372ba7 commit f977346

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sklearn/linear_model/coordinate_descent.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ def fit(self, X, y, Xy=None, coef_init=None):
130130
self.fit_intercept, self.normalize, copy=self.copy_X)
131131
precompute = self.precompute
132132
if X_init is not X and hasattr(precompute, '__array__'):
133-
precompute = 'auto' # recompute Gram
133+
# recompute Gram
134+
# FIXME: it could be updated from precompute and X_mean
135+
# instead of recomputed
136+
precompute = 'auto'
134137
if X_init is not X and Xy is not None:
135138
Xy = None # recompute Xy
136139

@@ -145,7 +148,7 @@ def fit(self, X, y, Xy=None, coef_init=None):
145148
X = np.asfortranarray(X) # make data contiguous in memory
146149

147150
# precompute if n_samples > n_features
148-
if hasattr(self.precompute, '__array__'):
151+
if hasattr(precompute, '__array__'):
149152
Gram = precompute
150153
elif precompute == True or \
151154
(precompute == 'auto' and n_samples > n_features):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy