Non-negative coefficients with lars #9837
Closed
Labels
Comments
thanks for the report. please make this do np.random.seed(i) for iteration
i, and report which i it breaks on so that the issue is easily replicated.
|
Code snippet import numpy as np
from sklearn.linear_model import Lars
import sklearn
flag = True
print sklearn.__version__
s = 100
while flag:
np.random.seed(s)
X = np.random.randn(10,5)
Y = np.random.randn(10)
l=Lars(fit_intercept=False, positive=True)
l.fit(X,Y)
print l.coef_
for i in l.coef_ :
if i < 0 :
flag = False
s += 1 Output
|
And what is s at the end? |
@jnothman random seed incremented at every iteration |
@jnothman Sorry didn't understand your question earlier. s=109 at the breaking point Code snippet
Output
|
So the minimal reproducing example is: import numpy as np
from sklearn.linear_model import Lars
np.random.seed(109)
X = np.random.randn(10,5)
Y = np.random.randn(10)
l = Lars(fit_intercept=False, positive=True)
l.fit(X,Y)
print(l.coef_)
assert(np.all(l.coef_ >= 0)) Thanks. I can reproduce, indeed. |
And the bug appears to have been present since |
Hi @jnothman, Can I work on this issue? |
If you're confident you can debug it, you're more than welcome to! |
see #10248 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am running this piece of code
I am getting the following output
0.19.0
[ 0.00000000e+00 0.00000000e+00 5.21722148e-01 3.10743837e-01
4.18778571e-04]
[ 0. 0. 0. 0.45541234 0.09542552]
[ 0.80960144 0.35327211 0.17399586 0.16972765 -0.02813728]
with negative coefficients
The text was updated successfully, but these errors were encountered: