Skip to content
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

BUG, TST: stats: fix RuntimeWarnings and add tests for the support method #13967

Closed

Conversation

tirthasheshpatel
Copy link
Member

Reference issue

closes gh-13504

What does this implement/fix?

The support method sometimes raised warnings when invalid inputs were given. This behavior has been fixed and a more comprehensive test suite for the support method has been added.

Additional information

In gh-13504,

Add tests for distribution support (and possibly other) method(s) with array inputs.

Are there any specific methods missing tests with array inputs? I think most of them have been tested for specific distributions but can't find many test that check all the methods of all the distributions with valid and invalid array inputs in scipy.stats.

@tirthasheshpatel tirthasheshpatel added maintenance Items related to regular maintenance tasks scipy.stats labels May 1, 2021
@mdhaber
Copy link
Contributor

mdhaber commented May 1, 2021

Are there any specific methods missing tests with array inputs?

Not sure offhand what others there are. It would take a close look.

@tirthasheshpatel
Copy link
Member Author

The failing tests seem related to the errors seen in gh-13844. I think we can add a np.testing.suppress_warnings() statement to ignore them. I am not sure why those are occurring (only on windows) so can't tell if this is a transient issue or a bug.

@tirthasheshpatel
Copy link
Member Author

Not sure offhand what others there are. It would take a close look.

I will take a closer look and try to incorporate those in this PR.

@tylerjereddy
Copy link
Contributor

@tirthasheshpatel do we basically just need a rebase here now or are there still some tests that are likely to fail?

Are the testing changes adjusting any old test cases, or just strictly adding guards for new test cases?

…thod

The support method sometimes raised warnings when invalid inputs were given.
This behaviour has been fixed and a more comprehensive test suite for the
support method has been added.
@tirthasheshpatel tirthasheshpatel force-pushed the test-array-support branch 2 times, most recently from b164cb4 to f45cedc Compare December 4, 2021 16:54
@tirthasheshpatel
Copy link
Member Author

I think it's fine to bump the milestone here as the primary goal of the PR is to add tests. I am thinking about using Hypothesis to centrally test multiple methods of all the distributions for more comprehensive testing rather than trying to write separate test cases for each method as I do here.

@rgommers rgommers modified the milestones: 1.8.0, 1.9.0 Dec 6, 2021
@rgommers rgommers modified the milestones: 1.9.0, 1.10.0 May 20, 2022
@mdhaber
Copy link
Contributor

mdhaber commented Aug 26, 2022

@tirthasheshpatel do you have some time to work on this over the next few months?
If not, shall we close this one and you can pick it up again when you have time?
Really, I'm hoping we'll find some support to work on gh-15928, and so writing a comprehensive test suite with the help of Hypothesis would be part of the plan. So it's OK with me if we don't start integrating that sort of the thing into the current suite.

@tirthasheshpatel
Copy link
Member Author

Really, I'm hoping we'll find some support to work on gh-15928, and so writing a comprehensive test suite with the help of Hypothesis would be part of the plan. So it's OK with me if we don't start integrating that sort of the thing into the current suite.

I agree! Moreover, I think the RuntimeWarnings here can occur for other combinations of inputs like a = np.inf and loc=-np.inf. Checking for all such conditions and fixing them doesn't seem much practical to me. Right now, I think it would be better to close this; since the output for invalid inputs is np.nan, I'd say it's sufficiently correct. Tests can be added when revamping the univariate distribution infrastructure.

Feel free to reopen if you disagree or have other comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Items related to regular maintenance tasks scipy.stats
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TST: stats: test distribution support method behavior for array input
5 participants