Skip to content

Conversation

mdhaber
Copy link
Contributor

@mdhaber mdhaber commented May 24, 2024

Reference issue

Toward gh-20544
Follow-up to gh-20777

What does this implement/fix?

Similar to gh-20777 but for hypothesis tests with a chi-squared null distribution.

Additional information

Technically I should probably be passing symmetric=False in all these calls to _get_pvalue, but alternative='greater' is specified explicitly, so it doesn't really matter.

@mdhaber mdhaber added scipy.stats enhancement A new feature or improvement array types Items related to array API support and input array validation (see gh-18286) labels May 24, 2024
@mdhaber mdhaber requested review from person142 and steppi as code owners May 24, 2024 17:06
array_args = [np.asarray(arg) for arg in array_args]
out = _f(*array_args, *other_args, **kwargs)
return _xp.asarray(out)
_f = _generic_implementations[f_name](xp=xp, spx=spx)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reworked _generic_implementations so we have more flexibility. Previously, _generic_implementations contained functions that had to work for any backend; now, _generic_implementations contains functions that return a function if possible/desired or None otherwise.

@mdhaber
Copy link
Contributor Author

mdhaber commented May 24, 2024

I've checked locally and all tests pass with CuPy now except test_power_divergence_against_cressie_read_data because it uses assert_allclose in the test. I should fix that here.

So this is ready for review, but there are minor things to change before merge even if CI passes. Update: CI failure is unrelated.

Copy link
Member

@j-bowhay j-bowhay left a comment

Choose a reason for hiding this comment

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

Thanks @mdhaber LGTM

So this is ready for review, but there are minor things to change before merge even if CI passes. Update: CI failure is unrelated.

Just wanted to double check these had been done before pressing the button

@mdhaber
Copy link
Contributor Author

mdhaber commented May 25, 2024

Oops, yes, all done. Thanks!

@j-bowhay j-bowhay merged commit cdc251d into scipy:main May 25, 2024
@j-bowhay j-bowhay added this to the 1.14.0 milestone May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
array types Items related to array API support and input array validation (see gh-18286) enhancement A new feature or improvement scipy.special scipy.stats
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants