8000 [MRG+1] Adds drop in FeatureUnion by thomasjpfan · Pull Request #11640 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[MRG+1] Adds drop in FeatureUnion #11640

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

Merged
merged 20 commits into from
Sep 13, 2018

Conversation

thomasjpfan
Copy link
Member
@thomasjpfan thomasjpfan commented Jul 20, 2018

Reference Issues/PRs

Addresses one of the issues in #11144.

What does this implement/fix? Explain your changes.

Uses drop and None in FeatureUnion.

@jnothman
Copy link
Member

This is not backwards compatible. Otherwise it's okay.

@thomasjpfan
Copy link
Member Author

Would it be better to support 'drop' and None?

@jnothman
Copy link
Member
jnothman commented Jul 22, 2018 via email

@thomasjpfan
Copy link
Member Author

I updated this PR to deprecate None. _check_params is called in fit, transform, and fit_transform to replace None with drop.

Copy link
Member
@jnothman jnothman left a comment

Choose a reason for hiding this comment

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

I think there is also mention of this in doc/modules/model_selection.rst that needs updating

if show_warning:
warnings.warn(
"Transformers set to None is now set with 'drop' "
"in version 0.20 and will be removed in 0.22.",
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this message is clear. Please reword it in a way that is helpful to someone who formerly used None

show_warning = False
for idx, (name, trans) in enumerate(self.transformer_list):
if trans is None:
self.transformer_list[idx] = (name, 'drop')
Copy link
Member

Choose a reason for hiding this comment

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

We avoid modifying user params generally.

@@ -488,7 +489,7 @@ def test_make_union_kwargs():
assert_equal(3, fu.n_jobs)
# invalid keyword parameters should raise an error message
assert_raise_message(
TypeError,
TypeError,
Copy link
Member

Choose a reason for hiding this comment

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

This changed indentation seems strange

Copy link
Member
@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

Deprecation message reads better now IMO. @jnothman does this need a whatsnew notice?

@jnothman
Copy link
Member
jnothman commented Jul 24, 2018 via email

@jnothman jnothman changed the title RFC: Converts None to drop in FeatureUnion [MRG+1] Converts None to drop in FeatureUnion Jul 25, 2018
@jorisvandenbossche
Copy link
Member

@jnothman for Pipeline 'passthrough' you argued to for now keep both (not directly deprecate None). Would you then argue the same here, or not?

@thomasjpfan
Copy link
Member Author

This PR was updated to not deprecate None.

@thomasjpfan thomasjpfan changed the title [MRG+1] Converts None to drop in FeatureUnion [MRG+1] Adds drop in FeatureUnion Aug 23, 2018
@jorisvandenbossche
Copy link
Member

This PR was updated to not deprecate None.

Whoops, sorry missed that

Copy link
Member
@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

Small comment on the tests, looks good to me!

@@ -827,7 +827,21 @@ def test_set_feature_union_steps():
assert_equal(['mock__x5'], ft.get_feature_names())


def test_set_feature_union_step_none():
def test_set_feature_union_test_none():

Choose a reason for hiding this comment

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

same comment here as in the other PR, might make sense to parametrize for None / 'drop'

Copy link
Member
@qinhanmin2014 qinhanmin2014 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 @thomasjpfan
I'll merge this for 0.20 to improve consistency between FeatureUnion and ColumnTransformer

@qinhanmin2014 qinhanmin2014 merged commit 5be05c6 into scikit-learn:master Sep 13, 2018
qinhanmin2014 added a commit that referenced this pull request Sep 14, 2018
Travis failed to detect it in #11640
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request Sep 17, 2018
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request Sep 17, 2018
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.

4 participants
0