Skip to content

TST use global_dtype in sklearn/cluster/tests/test_mean_shift.py #22672

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 8 commits into from
May 16, 2022

Conversation

jjerphan
Copy link
Member

@jjerphan jjerphan commented Mar 3, 2022

Reference Issues/PRs

Partially addresses #22881

Precedes #22590

What does this implement/fix? Explain your changes.

This parametrizes tests from test_mean_shift.py to run on 32bit datasets.

Any other comments?

We could introduce a mechanism to be able to able to remove tests' execution on 32bit datasets if this takes too much time to complete.

@jjerphan jjerphan marked this pull request as ready for review March 3, 2022 16:26
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.

Thanks for the PR.

I think at least one test (probably test_mean_shift would make most sense) needs to explicitly check the impact of changing the dtype of X on the expected dtype of ms.cluster_centers_.

Intuitively I would expect ms.cluster_centers_.dtype == X.dtype unless there is a good reason to systematically upcast to np.float64, in which case it should probably be documented with an inline comment in the test and in the docstring of for the cluster_centers_ attribute.

I also realize that no test check the expected shape of ms.cluster_centers_. I think test_mean_shift should be updated to do that.

@jjerphan jjerphan changed the title TST Adapt test_mean_shift.py to test implementations on 32bit datasets TST use global_dtype in sklearn/cluster/tests/test_mean_shift.py Mar 17, 2022
Co-authored-by: Jérémie du Boisberranger <jeremiedbb@users.noreply.github.com>
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.

LGTM. Just a few nitpicks

@jeremiedbb jeremiedbb added the Quick Review For PRs that are quick to review label Mar 24, 2022
@glemaitre glemaitre self-requested a review May 6, 2022 13:20
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.

I couple of comments.

Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
@ogrisel ogrisel merged commit 37cea54 into scikit-learn:main May 16, 2022
lesteve pushed a commit to lesteve/scikit-learn that referenced this pull request May 19, 2022
…kit-learn#22672)

Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Jérémie du Boisberranger <jeremiedbb@users.noreply.github.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
@jjerphan jjerphan deleted the tst/test_mean_shift-32bit branch October 21, 2022 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants