scipy.stats.uniform对a和b属性的混淆 [英] Confusion over `a` and `b` attributes from scipy.stats.uniform
问题描述
考虑以下代码:
import scipy
print(scipy.__version__) # gives 0.19.1
# Scipy.stats.uniform
unif = scipy.stats.uniform(1, 2)
print(unif.a, unif.b, unif.args) # gives a=0, b=1, args=(1,2)
似乎,不管值如何我提供 loc
和 scale
,统一
函数返回 a = 0,b = 1
。
It seems, regardless of the value I provide for loc
and scale
, the uniform
-function returns a=0,b=1
.
将其与例如 randint
:
# Scipy.stats.randint
randi = scipy.stats.randint(1, 10)
print(randi.a, randi.b, randi.args) # gives a=1, b=9, args=(1,10)
...它返回我期望的结果。
...which returns what I would expect.
所以我的问题变成了:这是 scipy
中的错误,还是我误解了某些东西?虽然 unif.args
值设置正确。
So my question becomes: is this a bug in scipy
, or have I misunderstood something? The unif.args
value is set correctly though.
干杯!
推荐答案
据我了解, a
和 b
是内部参数,在 scipy.stats.uniform
中不使用,因为它们的正常功能基本上可以复制 loc
和 scale
参数。
It is my understanding that the a
and b
are internal parameters, are not used in scipy.stats.uniform
, because their normal functionality is basically duplicative of the loc
and scale
parameters.
如 scipy.stats.uniform
文档此分布在 loc
和 loc
+ <$ c之间是恒定的$ c> scale 。
所以我不认为这是一个错误,因为 a的值
和 b
应该被视为实现细节,而不是面向用户的功能。
So I don't think this is a bug, because the values of a
and b
should be treated as an implementation detail rather than a user-facing feature.
这篇关于scipy.stats.uniform对a和b属性的混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!