Skip to content

[MRG] BUG fix inconsistency between fit and fit_transform in FeatureUnion #10098

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

Closed
wants to merge 1 commit into from

Conversation

glemaitre
Copy link
Member

Reference Issues/PRs

closes #10088

What does this implement/fix? Explain your changes.

Solve the inconsistent behaviour between fit and fit_transform in FeatureUnion.
Add test to check that either Pipeline and FeatureUnion accept dict.items().

Any other comments?

@amueller
Copy link
Member

amueller commented Nov 9, 2017

Is this the right regression test? Shouldn't we use the tuple test from #9716 on fit_transform?

X = np.array([[1, 2]])
pipeline_estimators = {'transf': Transf(),
'clf': FitParamT()}
pipe = Pipeline(pipeline_estimators.items())
Copy link
Member

Choose a reason for hiding this comment

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

what does that test? That we allow items in pipelines? Do we want to guarantee that?

@glemaitre
Copy link
Member Author

glemaitre commented Nov 9, 2017 via email

@glemaitre
Copy link
Member Author

glemaitre commented Nov 9, 2017

@amueller I got confused then :) Do you want to fix #10088 as proposed by @jnothman but without a regression test regarding the dict.items() and add an additional test to be sure that we make a deep copy of the transformer in the FeatureUnion when cloning?

@amueller
Copy link
Member

ok let's support dict items

@glemaitre
Copy link
Member Author

Uhm I did not even remember this one ;)

@jnothman
Copy link
Member

Can we really support this in Pipeline where order matters,

@amueller
Copy link
Member

@jnothman but in older Pythons the order is not deterministic, right? I'm probably missing what you're suggesting.

@jnothman
Copy link
Member

Yes, that's what I was trying to say. Supportin dictitems in Pipeline is problematic

@amueller amueller changed the title [MRG] BUG make FeatureUnion accpets dict items [MRG] BUG make FeatureUnion accept dict items May 24, 2018
@amueller
Copy link
Member

Ok but no-one is proposing that and this PR is not doing that, right?

@glemaitre
Copy link
Member Author

This PR was actually to remove the inconsistency between fit and fit_transform in FeatureUnion. It was revealed by the use of dict_items. So basically, my tests are misleading (and the title of the PR).

Shall we support dict in FeatureUnion? It would make that the type to be given in Pipeline and FeatureUnion are actually different. Is it an issue?

For sure, I should remove this test.

@glemaitre glemaitre changed the title [MRG] BUG make FeatureUnion accept dict items [MRG] BUG fix inconsistency between fit and fit_transform in FeatureUnion May 24, 2018
@glemaitre
Copy link
Member Author

Solved in master after some code refactoring

@glemaitre glemaitre closed this Jun 13, 2019
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.

FeatureUnion not accepting dict_items (appeared in the latest minor release)
3 participants