mars.tensor.random.standard_cauchy#

mars.tensor.random.standard_cauchy(size=None, chunk_size=None, gpu=None, dtype=None)[来源]#

从标准柯西分布中抽取样本,模式 = 0。

也被称为洛伦兹分布。

Parameters
  • size (inttupleints, 可选) – 输出形状。 如果给定的形状是,例如,(m, n, k),那么 m * n * k 个样本将被抽取。 默认值是 None,在这种情况下返回一个 单一值。

  • chunk_size (inttupleinttupleints, 可选) – 每个维度上所需的块大小

  • gpu (bool, 可选) – 如果为True,则在GPU上分配张量,默认为False

  • dtype (数据类型, 可选) – 返回的张量的数据类型。

Returns

样本 – 绘制的样本。

Return type

张量或标量

备注

完整的柯西分布的概率密度函数是

\[P(x; x_0, \gamma) = \frac{1}{\pi \gamma \bigl[ 1+ (\frac{x-x_0}{\gamma})^2 \bigr] }\]

标准Cauchy分布只需设置 \(x_0=0\)\(\gamma=1\)

柯西分布出现在驱动谐振子问题的解中,并且描述了光谱线的展宽。它还描述了一条以随机角度倾斜的直线将与 x 轴相交的值的分布。

在研究假设检验假定正态性时,查看这些检验在来自柯西分布的数据上的表现是它们对重尾分布的敏感性的一种良好指标,因为柯西分布看起来非常像高斯分布,但尾部更重。

参考文献

1

NIST/SEMATECH 统计方法电子手册,“柯西分布”,http://www.itl.nist.gov/div898/handbook/eda/section3/eda3663.htm

2

韦斯坦,埃里克·W。“柯西分布。”来自MathWorld–A Wolfram网络资源。 http://mathworld.wolfram.com/CauchyDistribution.html

3

维基百科,“柯西分布” http://en.wikipedia.org/wiki/Cauchy_distribution

示例

绘制样本并绘制分布:

>>> import mars.tensor as mt
>>> import matplotlib.pyplot as plt
>>> s = mt.random.standard_cauchy(1000000)
>>> s = s[(s>-25) & (s<25)]  # truncate distribution so it plots well
>>> plt.hist(s.execute(), bins=100)
>>> plt.show()