-
-
Notifications
You must be signed in to change notification settings - Fork 26k
TST fix estimator checks when set_output is called on the instance #29869
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
@parametrize_with_checks( | ||
[ | ||
StandardScaler().set_output(transform="pandas"), | ||
StandardScaler().set_output(transform="polars"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might need to have some skipif
because polars or pandas are optional dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these lines don't fail if pandas/polars are not installed, and check_estimator
also dosn't fail when they're not installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scratch that, it fails. I'll fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM as long as the comment above is resolved :)
|
||
|
||
# Test that set_output doesn't make the tests to fail. | ||
@parametrize_with_checks( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can not use parametrize_with_checks
here because it depends on pytest
. The simple fix is to move it to sklearn/tests/test_common.py
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kinda prefer to have test_common.py
to have as least tests as possible, to reduce the difference between what we force on third party estimators and what we expect from our own.
So I refactored the test here.
Fixes #26842
This fixes the issues with transformers where
set_output
is called on them.cc @glemaitre @Charlie-XIAO