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
ENH Allow isotonic reg 2d input with 1 feature (GH15012) #17379
ENH Allow isotonic reg 2d input with 1 feature (GH15012) #17379
Conversation
btw I tested the fix locally, it does indeed fix #17333. Again because it's essentially the same issue, I did not add any tests specifically testing If that test should be added, just let me know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @fujiaxiang !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @fujiaxiang , a few comments but looks good in general!
change flatten to reshape(-1) Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
change flatten to reshape(-1) Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
change array(list(range(10))) to arange(10) Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
simplify test input Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
simplify test input Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
simplify code Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
change assert_array_equal to assert_allclose Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
@thomasjpfan @NicolasHug thanks for reviewing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments, otherwise LGTM
reformat whatsnew entry Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
clean up comment in test case Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
@thomasjpfan committed the suggested changes. thanks :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have already approved this. This needs a second approval to get merged.
got it. will wait for @NicolasHug to review again |
ping |
ping |
hi @NicolasHug could you review again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for your patience @fujiaxiang
…1_feature' into isotonic_reg_allow_2darray_with_1_feature
Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
…w_2darray_with_1_feature
@NicolasHug thanks for the comments and suggestions. Have made the adjustments. Can you review again? |
hi @NicolasHug can you review again? |
|
||
y_pred1 = iso_reg.predict(X) | ||
y_pred2 = iso_reg_2d.predict(X_2d) | ||
assert_allclose(y_pred1, y_pred2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also check that the estimator attributes match in shape. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jnothman, thanks for review. Are you referring to the _necessary_X_
and _necessary_y_
attributes? I have added checking for these two attributes. If it's something else, can you give a bit more details what you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I meant the public attributes X_min_
, X_max_
, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @jnothman, sorry for the late reply. I have added the checks as requested. Could you review again?
…w_2darray_with_1_feature # Conflicts: # doc/whats_new/v0.24.rst # sklearn/tests/test_isotonic.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @fujiaxiang
Reference Issues/PRs
Fixes #15012
Fixes #17333
What does this implement/fix? Explain your changes.
This PR allows
IsotonicRegression
to accept 2D inputs in itsfit
,predict
andtransform
methods.