-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Lars.coef_ broken when fit_path=True #1615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the report. I noticed the change in the API when doing the release. I didn't notice it broke the decision function. We seem to be missing some tests there. |
@GaelVaroquaux and maybe @vene could you maybe have a look on how to best resolve that? |
hm maybe we should just change the decision_function implementation... |
you could also just use |
I am confused now... I can not reproduce that in master. Was that changed back again since the release? |
it works for me too. Can you give a more detailed snippet to reproduce the thanks |
OK, let me see if I can isolate an appropriate example |
I put off checking this, and now I actually can't seem to reproduce it in any of my code. Looks like it might have been my mistake -- oops! |
No problem. Thanks for checking :) |
Sorry to resurrect an old issue, but I think this bug is still lurking. Here's a minimal repro on current master: import numpy as np
from sklearn.linear_model import LassoLars
X = np.random.random((50, 3))
y = np.random.random((50, 2))
foo = LassoLars(fit_intercept=False)
foo.fit(X, y)
foo.predict(X) Running it results in the same problem with trying to transpose a list:
Some testing shows that the bug is only triggered with a 2D |
* Fix gh-1615: ensure self.coef_ is an ndarray
) * Fix scikit-learngh-1615: ensure self.coef_ is an ndarray
) * Fix scikit-learngh-1615: ensure self.coef_ is an ndarray
) * Fix scikit-learngh-1615: ensure self.coef_ is an ndarray
) * Fix scikit-learngh-1615: ensure self.coef_ is an ndarray
) * Fix scikit-learngh-1615: ensure self.coef_ is an ndarray
I am using LassoLars to solve a multi-dimensional sparse coding problem. After upgrading from 0.12.1 to 0.13, I have encountered a bug where the coef_ attribute of LassoLars is a list, not a numpy array. This breaks the decision_function method, since it takes the transpose of coef_:
/export/disk0/wb/python2.6/lib/python2.6/site-packages/sklearn/linear_model/base.pyc in decision_function(self, X)
138 """
139 X = safe_asarray(X)
--> 140 return safe_sparse_dot(X, self.coef_.T) + self.intercept_
141
142 def predict(self, X):
AttributeError: 'list' object has no attribute 'T'
This seems to be due to this change that made it into the 0.13 release by @GaelVaroquaux:
e18465d
The text was updated successfully, but these errors were encountered: