scipy.stats.multivariate_normal高斯分布

参考地址:https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.multivariate_normal.html

scipy.stats.multivariate_normal

Parameters:

x : array_like

Quantiles, with the last axis of x denoting the components.

mean : array_like, optional

Mean of the distribution (default zero)

cov : array_like, optional

Covariance matrix of the distribution (default one)

Alternatively, the object may be called (as a function) to fix the mean

and covariance parameters, returning a “frozen” multivariate normal

扫描二维码关注公众号,回复: 1655669 查看本文章

random variable:

rv = multivariate_normal(mean=None, scale=1)

  • Frozen object with the same methods but holding the given mean and covariance fixed.

The probability density function for multivariate_normal is

f(x) = \frac{1}{\sqrt{(2 \pi)^k \det \Sigma}} \exp\left( -\frac{1}{2} (x - \mu)^T \Sigma^{-1} (x - \mu) \right),

where \mu is the mean, \Sigma the covariance matrix, and k is the dimension of the space where x takes values.


举例:

from scipy.stats import multivariate_normal
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 5, 10, endpoint=False)
x

y = multivariate_normal.pdf(x, mean=2.5, cov=0.5); y

plt.plot(x, y)

猜你喜欢

转载自blog.csdn.net/weixin_41770169/article/details/80729252