Skip to content

FIX reshape the predicitons array shape in IterativeImputer#19409

Closed
isaacknjama wants to merge 17 commits intoscikit-learn:mainfrom
isaacknjama:imputer-reshape
Closed

FIX reshape the predicitons array shape in IterativeImputer#19409
isaacknjama wants to merge 17 commits intoscikit-learn:mainfrom
isaacknjama:imputer-reshape

Conversation

@isaacknjama
Copy link
Copy Markdown
Contributor

Reference Issues/PRs

Fixes #19352

What does this implement/fix? Explain your changes.

Fixes ValueError triggered when setting the estimator as PLSRegression().

Copy link
Copy Markdown
Member

@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the motive for using pytest context managers instead of sklearn.utils._testing.assert_raises?

@glemaitre
Copy link
Copy Markdown
Member

What is the motive for using pytest context managers instead of sklearn.utils._testing.assert_raises?

It is more intuitive and readable since you have the real function call instead of wrapping the function and the parameter within another testing function.

The linked issue is wrong in the summary is wrong, I will correct it.

@glemaitre
Copy link
Copy Markdown
Member

Uhm I see that you actually have changes from another PR (so my confusion regarding the original issue #14216 @jjerphan you can have a look).

Copy link
Copy Markdown
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a general comment, when you start to make a PR, you should create a branch from the main branch such that no changes from other branches are already inside it.

@glemaitre glemaitre changed the title Imputer reshape FIX reshape the predicitons array shape in IterativeImputer Feb 9, 2021
@glemaitre
Copy link
Copy Markdown
Member

Please add an entry to the change log at doc/whats_new/v*.rst. Like the other entries there, please reference this pull request with :pr: and credit yourself (and other contributors if applicable) with :user:.

@jjerphan
Copy link
Copy Markdown
Member

jjerphan commented Feb 9, 2021

It is more intuitive and readable since you have the real function call instead of wrapping the function and the parameter within another testing function.

I see, I thought using sklearn.utils._testing.assert_raises was a convention. Thanks!

@jeremiedbb
Copy link
Copy Markdown
Member

it was before pytest was adopted :)
Now we want to slowly remove all these utilities

@Mariam-ke
Copy link
Copy Markdown
Contributor

#DataUmbrella sprint
cc: @reshamas

@isaacknjama
Copy link
Copy Markdown
Contributor Author

As a general comment, when you start to make a PR, you should create a branch from the main branch such that no changes from other branches are already inside it.

@glemaitre Thank you. I'll keep that in mind.

@isaacknjama isaacknjama deleted the imputer-reshape branch February 13, 2021 10:26
@jjerphan
Copy link
Copy Markdown
Member

Hi @icky254

Why have you closed this PR? You were on a nice start. 🙂

@isaacknjama isaacknjama restored the imputer-reshape branch February 15, 2021 14:35
@isaacknjama isaacknjama reopened this Feb 15, 2021
@ogrisel
Copy link
Copy Markdown
Member

ogrisel commented Mar 5, 2021

@icky254 are you still interested in finalizing this PR by addressing the remaining comments above? Let us know if something is not clear.

@isaacknjama
Copy link
Copy Markdown
Contributor Author

@ogrisel I will finalize the PR. Thanks for the reminder.

@Mariam-ke
Copy link
Copy Markdown
Contributor

@icky254 How is this PR going? Please let us know if we can answer any questions.

cc: @reshamas

@isaacknjama
Copy link
Copy Markdown
Contributor Author

The conflicting file in sklearn/tests/test_dummy.py causes builds to my PR to fail. I don't think it's required for this PR. How can I trace the commit that had the changes to the file?

Comment on lines +173 to +174
- |Fix| Fix ValueError triggered when setting the estimator as PLSRegression() in
:class: `sklearn._iterative.py: func: _impute_one_feature`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a higher-level entry might be clearer to users?

Suggested change
- |Fix| Fix ValueError triggered when setting the estimator as PLSRegression() in
:class: `sklearn._iterative.py: func: _impute_one_feature`
- |Fix| :class:`cross_decomposition.PLSRegression` can now be used as an estimator for
:class:`impute.IterativeImputer`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we will need a non-regression test that should ensure that it is actually working in this PR while failing in the branch main

Copy link
Copy Markdown
Member

@jjerphan jjerphan Apr 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got back to the original issue, and it looks like some issues (like SkuaD01/scikit-learn#1) implemented a test for this.

@isaack-mungui and @SkuaD01: you probably can work together to have your changes integrated in mean. 🙂

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jjerphan Just to gain clarity, should I integrate changes in mean or follow through with @glemaitre's requested changes first?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can proceed with @glemaitre's request (I misspelled main and wrote mean).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Thanks!

Comment on lines +173 to +174
- |Fix| Fix ValueError triggered when setting the estimator as PLSRegression() in
:class: `sklearn._iterative.py: func: _impute_one_feature`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we will need a non-regression test that should ensure that it is actually working in this PR while failing in the branch main

@reshamas
Copy link
Copy Markdown
Member

@isaack-mungui
If you would like to work with someone on this PR, you can ask on Data Umbrella Discord, and someone from our recent sprint will likely be available to collaborate.

Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
@isaacknjama
Copy link
Copy Markdown
Contributor Author

@isaack-mungui
If you would like to work with someone on this PR, you can ask on Data Umbrella Discord, and someone from our recent sprint will likely be available to collaborate.

@reshamas Noted, thanks.

@isaacknjama isaacknjama requested a review from glemaitre April 17, 2021 11:51
isaacknjama and others added 4 commits April 18, 2021 12:57
Copy link
Copy Markdown
Member

@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @isaack-mungui!

@isaacknjama
Copy link
Copy Markdown
Contributor Author

LGTM, thanks @isaack-mungui!

Thanks for the feedback. @jjerphan

@cmarmo
Copy link
Copy Markdown
Contributor

cmarmo commented May 26, 2021

@glemaitre do you mind having a look here to check if your requested changes have been applied? Thanks!
@isaack-mungui perhaps you can find sometime to synchronize with upstream? The continuous integration workflow has changed in the meanwhile and it is important to check that all builds are successful before merge. Thanks for your patience!

@isaacknjama
Copy link
Copy Markdown
Contributor Author

@glemaitre do you mind having a look here to check if your requested changes have been applied? Thanks!
@isaack-mungui perhaps you can find sometime to synchronize with upstream? The continuous integration workflow has changed in the meanwhile and it is important to check that all builds are successful before merge. Thanks for your patience!

@cmarmo I'll do that ASAP. Thank you for the update!

@glemaitre glemaitre removed their request for review July 22, 2021 08:13
@cmarmo cmarmo added the Superseded PR has been replace by a newer PR label Jul 25, 2021
@glemaitre glemaitre closed this Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:cluster module:impute Superseded PR has been replace by a newer PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interactive Imputer cannot accept PLSRegression() as an estimator due to "shape mismatch"

8 participants