Skip to content

Conversation

mdhaber
Copy link
Contributor

@mdhaber mdhaber commented Jun 24, 2024

Reference issue

Toward gh-20544

What does this implement/fix?

This creates an array-API compatible var with features we need in other functions (e.g. nan_policy='omit'). The approach is to use _xp_mean to compute the second central moment, then correction is applied if need be.

This will be used by tvar, tstd, and the zscore functions.

@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 Jun 24, 2024
@mdhaber
Copy link
Contributor Author

mdhaber commented Jun 24, 2024

Failures are all due to JAX not supporting item assignment. I'll just skip JAX while #20085 (comment) is still unresolved and _lazywhere doesn't work with JAX.

Copy link
Member

@lucascolley lucascolley left a comment

Choose a reason for hiding this comment

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

all looks sensible to me!

[skip circle] [skip cirrus]
@lucascolley lucascolley merged commit 0a2a5c8 into scipy:main Jun 24, 2024
@lucascolley
Copy link
Member

thanks Matt!

@lucascolley lucascolley added this to the 1.15.0 milestone Jun 24, 2024
@lucascolley lucascolley changed the title ENH: stats.xp_var: array-API compatible variance with scipy.stats interface ENH: stats.xp_var: array-API compatible variance with scipy.stats interface Jul 6, 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.stats
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants