Permalink
Browse files

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.
  • Loading branch information...
1 parent 0372ba7 commit f97734698902f8240d5b10bb20f1b1cd09664ce0 @fabianp fabianp committed Jan 9, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 sklearn/linear_model/coordinate_descent.py
@@ -130,7 +130,10 @@ def fit(self, X, y, Xy=None, coef_init=None):
self.fit_intercept, self.normalize, copy=self.copy_X)
precompute = self.precompute
if X_init is not X and hasattr(precompute, '__array__'):
- precompute = 'auto' # recompute Gram
+ # recompute Gram
+ # FIXME: it could be updated from precompute and X_mean
+ # instead of recomputed
+ precompute = 'auto'
if X_init is not X and Xy is not None:
Xy = None # recompute Xy
@@ -145,7 +148,7 @@ def fit(self, X, y, Xy=None, coef_init=None):
X = np.asfortranarray(X) # make data contiguous in memory
# precompute if n_samples > n_features
- if hasattr(self.precompute, '__array__'):
+ if hasattr(precompute, '__array__'):
Gram = precompute
elif precompute == True or \
(precompute == 'auto' and n_samples > n_features):

0 comments on commit f977346

Please sign in to comment.