Keyword collision in scipy.stats.levy_stable.interval
See original GitHub issueIf you check the methods documentation of the Levy-stable continuous random variable you will see interval(alpha, alpha, beta, loc=0, scale=1)
. The problem is here that the first parameter for interval
itself is named alpha
and in the case of the Levy-stable distribution the first shape parameter is also called alpha
. This makes it really problematic if you use keyword arguments when calling interval
for a user-selected distribution. The only way out of it is renaming the the first parameter of interval
or maybe less breaking is renaming the shape parameters of levy_stable
.
Issue Analytics
- State:
- Created 8 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
scipy.stats.levy_stable — SciPy v1.9.3 Manual
A Levy-stable continuous random variable. As an instance of the rv_continuous class, levy_stable object inherits from it a collection of generic methods (see ......
Read more >SciPy 1.9.0 Release Notes — SciPy v1.9.3 Manual
#5982: Keyword collision in scipy.stats.levy_stable.interval. #6472: scipy.stats.invwishart does not check if scale matrix is symmetric.
Read more >SciPy 1.2.0 Release Notes — SciPy v1.9.3 Manual
The workers keyword accepts an int or map-like callable, and parallelises the solver (having ... scipy.optimize.newton can now accept a scalar or an...
Read more >Statistics (scipy.stats) — SciPy v1.9.3 Manual
All continuous distributions take loc and scale as keyword parameters to adjust the location and scale of the distribution, e.g., for the standard...
Read more >scipy.stats.levy — SciPy v1.9.3 Manual
This is the same as the Levy-stable distribution with a = 1 / 2 and b = 1 . The probability density above...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Rather than changing the shape parameter name
n
of those seven distributions, I’d suggest changing the name of the parametern
of thescipy.stats.rv_continuous.moment
method to eithermoment
, for consistency with the parameter namemoment
inscipy.stats.moment
, ororder
, which would also be a reasonable name.We could also consider changing the name of parameter
alpha
ofrv_continuous.interval
toconfidence_level
as instats.binomtest
, but maybe this name only makes sense when the interval in question is thought of as a confidence interval.Since these are the first arguments of the methods, they may be less likely to be specified as keywords. If that’s true, perhaps this would be less disruptive to users than changing the shape parameter names of some very common distributions. (Full disclosure, I’m thinking of what headache it would be to change all the documentation and tutorials of these distributions to reflect a shape parameter name change - especially
n
. I imagine changing a parameter name of the methods would be much easier as they are probably not often used as keywords in SciPy code.)Shall I propose this on the mailing list?
(Happy to push this forward a bit by e.g. drafting the test in gh-13490, but if it gets very messy, I might not see this through to completion any time soon. It’s looking like the cost/benefit of addressing this issue will be unfavorable, and it’s been waiting quite patiently for the past few years, so perhaps it doesn’t need to be a top priority.)
Closed by gh-13490. Well, the keyword collision is fixed, but the documentation issue still persists. If we fix gh-10328 (actually render distribution-specific documentation), that will be fixed, too.
Update: gh-15619 will fix the documentation and we’ll let that close this.