Skip to content

Conversation

@btel
Copy link
Contributor

@btel btel commented Feb 25, 2019

Reference Issues/PRs

Fixes issue #12750

What does this implement/fix? Explain your changes.

This PR implements a simple check of the arguments to make sure that the MissingIndicator raises an exception when both arguments sparse=True and missing_values=0 or array is sparse and missing_values=0. It fixes old tests that allowed for these cases and implements one new test.

Any other comments?

Copy link
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.

Could you add an entry in what's new

@btel
Copy link
Contributor Author

btel commented Feb 25, 2019

ok. I fixed all the issues that came up in the review. Most importantly,

  • removed spourius blank lines
  • removed the check for arguments sparse=True and missing_values=0, which, as pointed out by @jeremiedbb , was not necessary
  • added check in transform method

@jeremiedbb
Copy link
Member

jeremiedbb commented Feb 25, 2019

I think it's fine now. But maybe it would be more readable to separate the case sparse input + missing = 0, i.e. have a test which checks everything works on normal inputs and another one which checks that an error is raised otherwise.

@btel
Copy link
Contributor Author

btel commented Feb 25, 2019

@jeremiedbb that makes sense, but I would need to skip over some input combinations. Otherwise, I couldn't use pytest decorators. How would you do that?

@glemaitre
Copy link
Member

glemaitre commented Feb 25, 2019 via email

@jeremiedbb
Copy link
Member

jeremiedbb commented Feb 25, 2019

I would remove the missing=0 case from the current test and add a test with missing=0.

@btel
Copy link
Contributor Author

btel commented Feb 25, 2019

ok. I enumerated all possible combinations not involving missing_values == 0 and sparse inputs. For the latter case, I added a new test.

- |Fix| Fixed a bug in :class:`linear_model.LassoLarsIC`, where user input
``copy_X=False`` at instance creation would be overridden by default
parameter value ``copy_X=True`` in ``fit``.
parameter value ``copy_X=True`` in ``fit``.
Copy link
Member

Choose a reason for hiding this comment

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

Please avoid fixing pep8 issues not related to your PR. It makes reviews harder to follow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. I will avoid it for future PRs, but I guess I should keep this one.

Copy link
Member

Choose a reason for hiding this comment

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

we usually ask contributors to revert it :/

Copy link
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

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

LGTM

@glemaitre
Copy link
Member

LGTM. Will merged when CI are green.

@agramfort agramfort merged commit 5890cbc into scikit-learn:master Feb 26, 2019
@agramfort
Copy link
Member

thx @btel

@btel btel deleted the fix_missing_imputer branch February 26, 2019 14:17
@btel
Copy link
Contributor Author

btel commented Feb 26, 2019

my first every scikit-learn PR merged 🎊 Thanks @jeremiedbb @glemaitre @jnothman @agramfort for help!

@glemaitre
Copy link
Member

🍺 Thanks a lot.

xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
…rays (scikit-learn#13240)

* adding argument check for the case spare=True and missing_values=0
issue scikit-learn#12750

* missing indicator: handle case array is sparse and missing values==0
issue scikit-learn#12750

* fix flake8 issues

* remove empty lines

* remove sparse==True and missing_value==0 case; handle `transform` method

* remove blankline

* separate out test for missing_value==0 and sparse input

* remove spurious blank lines

* added what's new entry

* fixing lint issues

* remove redundant code

* fix issue number in "what's new"

* move duplicate code to _validate_input

* fix test for transform method

* remove nested if conditions
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
…rays (scikit-learn#13240)

* adding argument check for the case spare=True and missing_values=0
issue scikit-learn#12750

* missing indicator: handle case array is sparse and missing values==0
issue scikit-learn#12750

* fix flake8 issues

* remove empty lines

* remove sparse==True and missing_value==0 case; handle `transform` method

* remove blankline

* separate out test for missing_value==0 and sparse input

* remove spurious blank lines

* added what's new entry

* fixing lint issues

* remove redundant code

* fix issue number in "what's new"

* move duplicate code to _validate_input

* fix test for transform method

* remove nested if conditions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants