Skip to content

FIX Preserve y shape in TransformedTargetRegressor #31563

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

Conversation

kryggird
Copy link
Contributor

Reference Issues/PRs

Fixes 26530.

What does this implement/fix? Explain your changes.

This PR uses the existing self._training_dim to decide whether to squeeze y before passing it the inner regressor in TransformedTargetRegressor.

Any other comments?

I've also added a test in test_metaestimators_metadata_routing.py.

@betatim @glemaitre

Copy link

github-actions bot commented Jun 16, 2025

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: bbcb234. Link to the linter CI: here

@betatim
Copy link
Member

betatim commented Jun 17, 2025

Thanks for the Pull Request @kryggird! If you have the time, could you take a look at the linter's complaints - it has instructions on how to install and run the linters as well which in 99.9% will automagically fix all the complaints.

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.

Thanks for the PR @kryggird. I just moved the test you added into the TranformedTargetRegressor dedicated test file.

Please add a changelog entry. LGTM otherwise.

@jeremiedbb jeremiedbb merged commit 29b379a into scikit-learn:main Jul 28, 2025
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TransformedTargetRegressor forces 1d y shape to regressor
3 participants