-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
documentation of constraints in isotonic_regression #16329
Description
The docstring of isotonic_regression says
scikit-learn/sklearn/isotonic.py
Line 84 in 91badfa
| subject to y_min = y_[1] <= y_[2] ... <= y_[n] = y_max |
Notice the equalities with respect to min and max.
However, the function does not actually force the smallest estimate to be y_min and the largest to be y_max. I believe that is the correct behavior; the estimates should be constrained, not fixed.
The docstring should therefore read
subject to y_min <= y_[1] <= y_[2] ... <= y_[n] <= y_max
If this is changed,
scikit-learn/sklearn/isotonic.py
Line 147 in 91badfa
| and min(y_) = y_min, max(y_) = y_max |
should be changed as well.
What the function does is to apply np.clip, i.e. first unconstrained estimates are produced and then everything outside of [y_min, y_max] is forced to these values.
scikit-learn/sklearn/isotonic.py
Line 135 in 91badfa
| np.clip(y, y_min, y_max, y) |
I am not sure that is the correct approach for constrained quadratic optimization (but also don't know positively it to be incorrect).
Tagging @bnaul and @agramfort since they seem to have introduced this line.