question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Keyword collision in scipy.stats.levy_stable.interval

See original GitHub issue

If 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:closed
  • Created 8 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
mdhabercommented, Apr 10, 2021

Rather than changing the shape parameter name n of those seven distributions, I’d suggest changing the name of the parameter n of the scipy.stats.rv_continuous.moment method to either

  • moment, for consistency with the parameter name moment in scipy.stats.moment, or
  • order, which would also be a reasonable name.

We could also consider changing the name of parameter alpha of rv_continuous.interval to confidence_level as in stats.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.)

0reactions
mdhabercommented, Feb 18, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found