The Wayback Machine - https://web.archive.org/web/20250523060006/https://github.com/scikit-learn/scikit-learn/pull/10719
Skip to content

[MRG + 1] Add sklearn.compose #10719

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 13 commits into from
Mar 16, 2018
Merged

Conversation

jnothman
Copy link
Member

This moves TransformedTargetRegressor (a Pipeline-like object) to the new module, which will also be home to ColumnTransformer (a FeatureUnion-like object).

This does not move/rewrite Pipeline or FeatureUnion, but moves their documentation to the generalised compose.html.

Fixes #10215

@lesteve
Copy link
Member

lesteve commented Feb 28, 2018

You may need to update setup.py to fix the AppVeyor error. IIRC AppVeyor tests the installed package but not Travis. Maybe the reason Travis does not fail is because it uses use python setup.py develop ... if that's the reason indeed I would be in favour of changing it to python setup.py install.

@jnothman
Copy link
Member Author

Test passing, and I'm fairly happy with how the docs render.

Not sure if examples/preprocessing/plot_transformed_target.py should be moved, or if examples/compose should be created and should include examples/{hetero_feature_union.py,plot_digits_pipe.py,plot_feature_stacker.py}

Copy link
Member

@lesteve lesteve left a comment

Choose a reason for hiding this comment

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

I have not really followed the long-term plan of moving things to compose I have to say.

Outside of this, I looked at the generated documentation and it looks good.

===============================================
<meta http-equiv="refresh" content="1; url=./compose.html" />
<script>
window.location.href = "./compose.html";
Copy link
Member

Choose a reason for hiding this comment

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

Just curious, what is the point of both setting window.location.href and using http-equiv="refresh" solution? I thought only the latter would work.

@jnothman
Copy link
Member Author

jnothman commented Feb 28, 2018 via email

@jnothman
Copy link
Member Author

jnothman commented Feb 28, 2018 via email

:ref:`FeatureUnion <feature_union>` which concatenates the output of
transformers into a composite feature space. :ref:`TransformedTargetRegressor
<transformed_target_regressor>` deals with transforming the :term:`target`
(:term:`y`) (e.g. log-transform) while Pipelines only transform the observed
Copy link
Member

Choose a reason for hiding this comment

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

small nitpick: but you can still put a TransformedTargetRegressor inside a Pipeline .. ? (and then the pipeline transforms also y)

Copy link
Member Author

@jnothman jnothman Mar 5, 2018

Choose a reason for hiding this comment

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

That's like saying a pipeline can transform y already because it can include a regressor that centres y before regression. I don't think it appropriate to be so pedantic here.

Copy link
Member

Choose a reason for hiding this comment

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

Well, my first reaction when reading it (being honest here) was: "oh, can a Pipeline not hold a TransformedTargetRegressor", but maybe I was thinking through too much :)

I think it is mainly the "while" that was triggering it. For example making it two separate sentences, or switching the order (first pipeline and then TTR) might already solve my confusion.

Copy link
Member

Choose a reason for hiding this comment

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

I thought a bit like @jorisvandenbossche but you have a good point

@glemaitre
Copy link
Member

After solving the conflict LGTM

@glemaitre glemaitre changed the title [MRG] Add sklearn.compose [MRG + 1] Add sklearn.compose Mar 15, 2018
@jnothman
Copy link
Member Author

jnothman commented Mar 15, 2018 via email

@glemaitre
Copy link
Member

Conflict solved.

Any comment on the side of @jorisvandenbossche or @lesteve ?

@lesteve
Copy link
Member

lesteve commented Mar 16, 2018

Resolved conflicts, please someone quickly double-check that I did make any mistakes.

@lesteve
Copy link
Member

lesteve commented Mar 16, 2018

Ooops sorry @glemaitre I did not refresh the page ... hopefully we did it the same way (pipeline.rst had 2 minor changes adding gamma='scale' to SVC).

@glemaitre
Copy link
Member

Yes it was what I had when solving conflict.
LGTM then :)

1 similar comment
@glemaitre
Copy link
Member

Yes it was what I had when solving conflict.
LGTM then :)

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

@qinhanmin2014 qinhanmin2014 merged commit b43fce5 into scikit-learn:master Mar 16, 2018
@amueller
Copy link
Member

Glad to see there's progress on this.
Is there an issue for the pipeline move?

@glemaitre
Copy link
Member

glemaitre commented Mar 20, 2018 via email

@amueller
Copy link
Member

@glemaitre that's an easy (incompatible) fix to pipeline, though, right? So we're gonna move it over and long-term deprecate the old one? Or are you suggesting to give the new one a different name? I don't think that's a good idea.

@jnothman
Copy link
Member Author

jnothman commented Mar 24, 2018 via email

@amueller
Copy link
Member

Ok and the issue we use to track is #8157 ?
I remember you said that constructing pipelines from fitted estimators is different from cloning, but I don't remember if we had a detailed discussion on that (it should probably live in #8157 ?)

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.

6 participants