【问题标题】:SciPy Relative Frequency: Default Real LimitsSciPy 相对频率:默认实际限制
【发布时间】:2015-10-15 12:34:02
【问题描述】:

我对 scipy.stats.relfreq() 中的 'defaultreallimits' 参数有疑问:

'defaultreallimits' 参数允许将元组指定为(下限,上限)阈值,据此可以计算给定数组中数据的相对频率。但是,我不清楚这样的上限和下限元组是否包含完全等于指定上限和下限的值。 比如下面这行代码,my_array中等于100还是500的值会被计入相对频率的计算中吗?

scipy.stats.relfreq(my_array, numbins=10, defaultreallimits=(100,500), weights=None)

这是 SciPy 上“defaultreallimits”描述的链接: http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.relfreq.html

谢谢

【问题讨论】:

    标签: python numpy statistics scipy


    【解决方案1】:

    如果您查看source,您会看到对 scipy.stats.histogram 的调用:

    h, l, b, e = histogram(a, numbins, defaultreallimits, weights=weights)
    

    查看同一文件中histogram 的源代码,参数变为defaultlimits,您发现对numpy.histogram 的调用,它变为range。

    在source 为numpy.histogram 中,它使用:

    bins = linspace(mn, mx, bins + 1, endpoint=True)
    

    这意味着端点mn 和mx 包括在内,如果我没看错代码的话。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-09-29
      • 1970-01-01
      • 2020-08-05
      • 2019-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多