scipy.stats.uniform 的参数是什么? [英] What are the arguments for scipy.stats.uniform?
问题描述
我正在尝试在两个数字(下限和上限)之间创建均匀分布,以便将其提供给 sklearn 的 ParameterSampler.我正在使用 scipy.stats.uniform 格式如下:
I'm trying to create a uniform distribution between two numbers (lower bound and upper bound) in order to feed it to sklearn's ParameterSampler. I am using scipy.stats.uniform in the following format:
from scipy.stats import uniform
params = ParameterSampler({'bandwidth':uniform(5,50)}, 20)
但是当我得到带宽"参数的随机选择时,它们并不都在 5 到 50 之间.其中一些比 50 大一点.所以我的问题是 scipy.stats.uniform 中的参数代表什么?它们不是下限和上限吗?文档没有显示任何参数,所以我无法从中弄清楚.
But when I get the random selections of the 'bandwidth' parameter, they are not all between 5 and 50. Some of them are bigger than 50 by a bit. So my question is what do the arguments in scipy.stats.uniform represent? Are they not a lower bound and upper bound? The documentation shows no arguments so I can't figure it out from that.
推荐答案
第一个参数是下限,第二个参数是分布的范围.因此,您问题中的示例分布在 5 到 55 之间是统一的.
The first argument is the lower bound, and the second argument is the range of the distribution. So the example distribution in your question is uniform between 5 and 55.
引自 文档 链接在您的问题中:
Quoting from the documentation linked in your question:
均匀连续随机变量.
这个分布在 loc
和 loc + scale
之间是恒定的.
This distribution is constant between loc
and loc + scale
.
loc
是第一个参数,scale
是第二个参数.
loc
is the first argument and scale
is the second argument.
这篇关于scipy.stats.uniform 的参数是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!