Skip to content

TST allow setting per test settings for estimators #29820

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 9 commits into from
Sep 12, 2024

Conversation

adrinjalali
Copy link
Member

allow multiple settings for each test...

@adrinjalali adrinjalali added the Developer API Third party developer API related label Sep 9, 2024
Copy link

github-actions bot commented Sep 9, 2024

✔️ Linting Passed

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

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

@adrinjalali adrinjalali changed the title TST allow testing on multiple instances of estimators TST allow setting per test settings for estimators Sep 10, 2024
@adrinjalali adrinjalali marked this pull request as ready for review September 10, 2024 13:17
@adrinjalali
Copy link
Member Author

@ogrisel @glemaitre this is the per-test setting PR.

@glemaitre glemaitre self-requested a review September 10, 2024 15:57
Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

Shall we offer a semi-public dev API to register custom params for third party estimator developers?

If so, it should probably be documented somewhere (along with the estimator check API) in the user guide, probably at one of the following:

@ogrisel
Copy link
Member

ogrisel commented Sep 11, 2024

By the way I can also review this PR as is (as an internal refactoring) without thinking about third party developer API first and defer the third party estimator API to a later PR.

@adrinjalali
Copy link
Member Author

adrinjalali commented Sep 11, 2024

@ogrisel I plan to write a new page for "how to write your estimator" anyway, but a bit later. These will certainly find their way there.

I also plan to expose this functionality to third party devs, but first prefer to be mostly done with test refactoring, since during this phase we're gonna add/remove/rename a lot of tests. But I added a note in the code to remember this point.

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

LGTM then. Maybe a follow-up could be to allow registering custom test data generators per-estimators (if we have a need for that).

Apparently it used to be the case for RANSACRegressor but it isn't anymore based on this diff?

@adrinjalali
Copy link
Member Author

allow registering custom test data generators per-estimators

Yeah I was happy that, that part of the code could be removed, but when we get to supporting non-numerical data for estimators, that test-generator-registration is gonna be necessary anyway. So it'll come.

@ogrisel
Copy link
Member

ogrisel commented Sep 11, 2024

Maybe you might want to see if test_pca_array_api_compliance could be refactored as part of this PR to check that the new infra is expressive enough for this use case?

Alternatively we can do it in a follow-up.

@adrinjalali
Copy link
Member Author

I see. That's easy to include, but needs a tiny bit of restructuring. Happy to do that, but rather keep these PRs as small as it gets so that we move forward fast. I can work on that once we merge this PR.

@adrinjalali
Copy link
Member Author

@ogrisel note that the test you mention has two issues:

test_pca_array_api_compliance basically is running two tests:

  • check_array_api_input_and_values: This somehow lives under estimator_checks.py but is NOT a part of the common tests. It's an alias for check_array_api_input(..., check_values=True), while check_array_api_input(..., check_values=False) is in common tests.
  • check_array_api_get_precision: This is in test_pca.py and is not a part of the common tests, so I'm not sure if it's relevant here.

This seems like something we should tackle separate from this PR.

Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

LGTM.

@glemaitre glemaitre merged commit 7bcae6c into scikit-learn:main Sep 12, 2024
30 checks passed
@adrinjalali adrinjalali deleted the tests/multi branch September 12, 2024 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Developer API Third party developer API related module:utils
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants