简体   繁体   English

Numpy 的多元正态示例不清楚

[英]Numpy's Multivariate Normal example is not clear

I am not sure if this question fits to numpy users or mathematicians.我不确定这个问题是否适合 numpy 用户或数学家。 I don't understand how the numpy.random.multivariate_normal example works.我不明白numpy.random.multivariate_normal示例是如何工作的。

In the bottom of the documentation, it generates a few random values given a mean and covariance matrix,在文档的底部,它会生成一些给定均值和协方差矩阵的随机值,

mean = (1, 2)
cov = [[1, 0], [0, 1]]
x = np.random.multivariate_normal(mean, cov, (3, 3))

and then says:然后说:

The following is probably true, given that 0.6 is roughly twice the standard deviation.以下可能是正确的,因为 0.6 大约是标准偏差的两倍。

I understand that this is coming from the empirical rule but I don't know how the standard deviation is 0.3.我知道这是来自 经验规则,但我不知道标准偏差是 0.3。

Can anyone help me through this?谁能帮我解决这个问题?

The sentence you refer to, refers to the property of a normal distribution in general ( enter link description here ),您所指的句子通常是指正态分布的属性( 在此处输入链接描述),

在此处输入图像描述

and not to some NumPy -specific functionality.而不是某些NumPy特定的功能。 As you normalize the samples you ger, ie, reduce the mean, the distribution is shifted around 0 , and given that the std of the samples is 0.3 , than most of the samples will be generated in range which is less than 3*0.3 = 0.9 from the mean, viz.当您对您的样本进行归一化时,即减少平均值时,分布会在0附近移动,并且假设样本的std0.3 ,那么大多数样本将在小于3*0.3 = 0.9的范围内生成3*0.3 = 0.9从平均值,即。 0, with the following proportion: 0,比例如下:

  • ~68.27% in range [-0.3, +0.3] ~68.27% 在 [-0.3, +0.3] 范围内
  • ~95.45% in range of [-0.6, +0.6] ~95.45% 在 [-0.6, +0.6] 范围内
  • ~99.73% in range of [-0.9, +0.9] ~99.73% 在 [-0.9, +0.9] 范围内

so, it follows that roughly 95% of the times the X you get in the vector you produce will be smaller than 0.6, if the std=0.3 .因此,如果std=0.3 ,您在生成的向量中获得的 X 大约有 95% 的时间小于 0.6。

Cheers干杯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 理解 Numpy 的 `multivariate_normal` 方法 - Understanding Numpy's `multivariate_normal` method 多元法线的Numpy向量化 - Numpy vectorization of multivariate normal Numpy:多元正态分布的对数似然 - Numpy: Loglikelihood of Multivariate Normal Distribution 有人有示例numpy.fftn代码正确实现multivariate_normal pdf吗? - Does anyone have example numpy.fftn code that correctly implements multivariate_normal pdf? `numpy.random.multivariate_normal`的矢量化实现 - Vectorized implementation for `numpy.random.multivariate_normal` 使用Numpy重塑多元普通函数中的错误-Python - Reshaping error in multivariate normal function with Numpy - Python 使用 numpy 和 matplotlib 在 3 维中可视化多元正态分布 - Visualizing a multivariate normal distribution with numpy and matplotlib in 3 Dimensions 向量化多元正态 pdf python (PyTorch/NumPy) - Vectorize multivariate normal pdf python (PyTorch/NumPy) 有没有办法以向量化的方式从 Numpy 的多元正态分布中批量采样? - Is there a way of batch sampling from Numpy's multivariate normal distribution in a vectorised fashion? 使用numpy的multivariate_normal随机抽样时内存不足 - Out of memory when using numpy's multivariate_normal random sampliing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM