[MRG+1] FIX Isotonic Regression for duplicate minimal value#3995
[MRG+1] FIX Isotonic Regression for duplicate minimal value#3995jnothman merged 3 commits intoscikit-learn:masterfrom jmetzen:fix_isotonic
Conversation
|
LGTM. |
|
Actually it would be great to try to understand what is the issue with |
|
The following happens when the values are passed directly to interp1d: Everything works fine in the case without duplicates: I will open a related bug report in scipy. For the moment, the workaround of this PR should fix the issue. |
|
Ok once you have the issue reported to scipy, please add an inline comment with the scipy issue number next to the line with the workaround in the scikit-learn source code. |
|
LGTM too |
|
@jmetzen have you opened the issue at scipy? I would like to reference it before we merge this workaround to sklearn master to ensure traceability. |
|
The scipy issue is 4304 (scipy/scipy#4304) and I've added an inline comment in isotonic_regression. |
|
Then this looks good to me too. Merging. Thanks! |
[MRG] FIX Isotonic Regression for duplicate minimal value
There was a problem hiding this comment.
sorry, my bad. this PR is already merged but I will fix it in the related PR #1176
|
Should we not rather use one of the recommended interpolation routines such as |
|
I tried to avoid any changes that would cause differences in the learned model. But you are right, kind="linear" and kind="slinear" give identical results as far as I can see it (besides the nan issue, which does not occur in slinear). See also here: scipy/scipy#4304 |
[MRG+1] MAINT Remove temporary fix #3995 in view of the change to slinear.
|
Just a note that the workaround from 2014, scipy/scipy#4304, no longer works. |
|
@ev-br thanks for the heads up but as of 0.18 we don't use |
Fixes an issue of Isotonic Regression when the minimal value of fitting is duplicated, e.g.:
would return
nan(see test_isotonic_duplicate_min_entry). The deeper reason for this seems to be in interpolate.interp1d. This issue is fixed by clipping not to minimal value observed in fitting but to minimal value + np.finfo(float).resolution.