Skip to content

FIX Preserve y shape in TransformedTargetRegressor - #31563

Merged
jeremiedbb merged 4 commits into
scikit-learn:mainfrom
kryggird:26530-preserve-y-shape-in-transformed-target-regressor
Jul 28, 2025
Merged

FIX Preserve y shape in TransformedTargetRegressor#31563
jeremiedbb merged 4 commits into
scikit-learn:mainfrom
kryggird:26530-preserve-y-shape-in-transformed-target-regressor

Conversation

@kryggird

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

@github-actions

github-actions Bot commented Jun 16, 2025

Copy link
Copy Markdown

✔️ Linting Passed

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

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

@betatim

betatim commented Jun 17, 2025

Copy link
Copy Markdown
Member

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.

@jeremiedbb jeremiedbb left a comment

Copy link
Copy Markdown
Member

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
@jeremiedbb jeremiedbb modified the milestone: 1.7.2 Aug 4, 2025
lucyleeow pushed a commit to lucyleeow/scikit-learn that referenced this pull request Aug 22, 2025
…earn#31563)

Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
jeremiedbb added a commit to jeremiedbb/scikit-learn that referenced this pull request Sep 3, 2025
…earn#31563)

Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
@jeremiedbb jeremiedbb mentioned this pull request Sep 3, 2025
13 tasks
jeremiedbb added a commit that referenced this pull request Sep 8, 2025
Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
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