-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
TST: stats.ttest_1samp: fix xslow test #20642
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3711,8 +3711,8 @@ def test_1samp_ci_iv(self, xp): | |||||||||
def test_pvalue_ci(self, alpha, data_axis, alternative, xp): | ||||||||||
# test relationship between one-sided p-values and confidence intervals | ||||||||||
data, axis = data_axis | ||||||||||
data = data.astype(copy=True) # ensure byte order | ||||||||||
data = xp.asarray(data) | ||||||||||
data = data.astype(np.float64, copy=True) # ensure byte order | ||||||||||
data = xp.asarray(data, dtype=xp.float64) | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Am I missing something with the "ensure byte order" comment? Can we not just include the
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay, if that isn't possible then I think this looks okay. Maybe worth adding a comment as to why. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I adjusted the test strategy to generate normal |
||||||||||
res = stats.ttest_1samp(data, 0., | ||||||||||
alternative=alternative, axis=axis) | ||||||||||
l, u = res.confidence_interval(confidence_level=alpha) | ||||||||||
|
@@ -3722,7 +3722,7 @@ def test_pvalue_ci(self, alpha, data_axis, alternative, xp): | |||||||||
res = stats.ttest_1samp(data, popmean, alternative=alternative, axis=axis) | ||||||||||
shape = list(data.shape) | ||||||||||
shape.pop(axis) | ||||||||||
ref = xp.broadcast_to(xp.asarray(1-alpha), shape) | ||||||||||
ref = xp.broadcast_to(xp.asarray(1-alpha, dtype=xp.float64), shape) | ||||||||||
xp_assert_close(res.pvalue, ref) | ||||||||||
|
||||||||||
|
||||||||||
|
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.
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 did check that all these incantations pass locally on x86_64 Linux, while they fail on
main
:I tried to play picky reviewer and force
float32
instead offloat64
locally, and saw overflow/invalid value warnings, so that seems like a plausible justification for non-stats
expert at least.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.
(obivously the first one has limited value, since it is cpu only)