-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
DOC: clarify expect() return val when moment is inf/nan #9267
Conversation
112a477
to
ddc4d0e
Compare
d84b2b8
to
278a753
Compare
Also, I noticed I had put |
To help in understanding the effect of bounds an example in the docstring with integrating constant function might be useful. i.e. expect of |
278a753
to
397f6c8
Compare
*Closes github issue scipy#9259
397f6c8
to
22fe291
Compare
@chrisb83 , @josef-pkt, I'm new here should I close the PR if all the comments are addressed? |
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.
Hi, the text is fine, i added a few formatting details. Please don't close the PR, it will be merged by one of the members once approved.
*Closes github issue scipy#9259
b011374
to
0af098d
Compare
0af098d
to
9cef980
Compare
@chrisb83, Thanks for all your time (and keen eyes!) so far, super helpful. All check are passing. Do you see any other issues in the commit? |
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.
Thanks, this looks good now. Only one minor thing: It would be nice to have the examples in a section "Examples" but this can also be done in a later PR.
*Closes github issue scipy#9259
9cef980
to
b616335
Compare
@chrisb83, Thanks! I added in 2 lines separation with "Examples" header in lines 2394 + 2395. Unclear if we want the "for example" examples from the previous ¶ in the new examples section. The doc seems to read better with them in the previous ¶ so I left them in that ¶. |
I think it is fine, normally the examples are written in a way that the code is run and the user sees the results, see e.g. https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.jarque_bera.html let's wait a few more days if there is further feedback, otherwise I will merge it |
will do. |
@chrisb83, it's been a few days and no one has responded. Should I ping the others contributors on the PR? |
scipy/stats/_distn_infrastructure.py
Outdated
|
||
Examples | ||
-------- | ||
To understand the effect of the bounds of integration consider the |
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.
Sorry for the last minute review but can we make this as code examples
To understand the effect of the bounds of integration consider
>>> from scipy.stats import expon
>>> expon(1).expect(lambda x: 1, lb=0.0, ub=2.0)
0.6321205588285578
This is close to
>>> expon(1).cdf(2.0) - expon(1).cdf(0.0)
0.6321205588285577
If ``conditional=True``
>>> expon(1).expect(lambda x: 1, lb=0.0, ub=2.0, conditional=True)
1.0000000000000002
The slight deviation from 1. is due to numerical integration.
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.
@ilayn, thanks. I added the examples docstring similar to how you have it here. and pushed. The builds all seem to pass except the Travis build which only fails on python 3.5 and the tests that are failing are totally unrelated (in signals sub-module)-or at least appear to be-to the changes. All other python versions in the travis build pass the checks. Maybe these are some flaky tests?
Closes #9259