You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Broken example for multilabel classification example with cca #4643
changed the title [-]Broken example for multilabel classification with cca[/-][+]Broken example for multilabel classification example with cca[/+]on Apr 29, 2015
I had a look into the code and the problem seems to be the break in line 299 in pls_.py. (The line was added in 9c66a20)
Unfortunately I'm not familiar enough with the algorithm to fix this, but it seems that the algorithm stops too early.
Additionally, when I try the code for the plot with different values for random_state (e.g. 10), I can still reproduce the error: ValueError: array must not contain infs or NaNs
Yes, I'm using the current dev version.
I'm not sure if the break is really the problem here, but when I remove it, the plots are created and look good to me.
For completeness here the part of my traceback:
...
File "/home/.../scikit-learn/sklearn/cross_decomposition/pls_.py", line 40, in _nipals_twoblocks_inner_loop
X_pinv = linalg.pinv(X) # compute once pinv(X)
File "/usr/lib/python2.7/dist-packages/scipy/linalg/basic.py", line 600, in pinv
a = np.asarray_chkfinite(a)
File "/usr/lib/python2.7/dist-packages/numpy/lib/function_base.py", line 595, in asarray_chkfinite
"array must not contain infs or NaNs")
ValueError: array must not contain infs or NaNs
setting scale=False "fixes" the first plot. That was the buggy behavior prior to my "fix" (?). The second CCA plot looks the same though. Not sure if that means anything.
Yes the error is in plot_hyperplane. As for training single set having single class, n_classes is set to 2, but on increasing this number I no longer get any error.
the training set having a single class doesn't mean n_classes is set to zero. It means your random state was "unlucky" and you didn't get any samples of the negative class, I think.
Activity
[-]Broken example for multilabel classification with cca[/-][+]Broken example for multilabel classification example with cca[/+]ssaeger commentedon Apr 29, 2015
I had a look into the code and the problem seems to be the
breakin line 299 in pls_.py. (The line was added in 9c66a20)Unfortunately I'm not familiar enough with the algorithm to fix this, but it seems that the algorithm stops too early.
Additionally, when I try the code for the plot with different values for
random_state(e.g. 10), I can still reproduce the error:ValueError: array must not contain infs or NaNs
I hope this helps somehow.
amueller commentedon Apr 29, 2015
Interesting. I'm not sure how that could break the result.... @ssaeger so you get the ValueError on current dev, that is after 9c66a20?
ssaeger commentedon Apr 29, 2015
Yes, I'm using the current dev version.
I'm not sure if the
breakis really the problem here, but when I remove it, the plots are created and look good to me.For completeness here the part of my traceback:
amueller commentedon Apr 29, 2015
I'll try to investigate (tomorrow?)
amueller commentedon Apr 30, 2015
for the record,
random_state=10reproduces the value error.amueller commentedon Apr 30, 2015
I don't understand what is happening, and at this point I'm afraid to touch the code further without some significant reading on my part...
amueller commentedon Jun 11, 2015
setting
scale=False"fixes" the first plot. That was the buggy behavior prior to my "fix" (?). The second CCA plot looks the same though. Not sure if that means anything.mth4saurabh commentedon Dec 1, 2015
@amueller Interestingly I am getting different error when I change
random_stateto 10, last line of the traceback:amueller commentedon Dec 8, 2015
@mth4saurabh that is a bit odd, but that just means your training set had only a single class. The error is in
plot_hyperplane, right?mth4saurabh commentedon Dec 9, 2015
Yes the error is in
plot_hyperplane. As for training single set having single class,n_classesis set to 2, but on increasing this number I no longer get any error.amueller commentedon Dec 10, 2015
the training set having a single class doesn't mean
n_classesis set to zero. It means your random state was "unlucky" and you didn't get any samples of the negative class, I think.amueller commentedon Jul 16, 2018
this was fixed long ago.