Open junxnone opened 3 years ago
μ=0 σ=1
若随机变量 X 密度函数为:
则称随机变量 X 服从正态分布 X ~ (μ,σ2)
import numpy as np import matplotlib.pyplot as plt import math def normal_distribution(x, mu, sigma): return np.exp( -1 * ( (x-mu) ** 2) / ( 2 * (sigma ** 2)) ) / (math.sqrt( 2 * np.pi ) * sigma) mu, sigma = 0, 1 x = np.linspace( mu - 6 * sigma, mu + 6 * sigma, 100) y = normal_distribution(x, mu, sigma) plt.plot(x, y, 'r', label='mu = 0,sigma = 1') y = normal_distribution(x, 0, 2) plt.plot(x, y, 'b', label='mu = 0,sigma = 2') y = normal_distribution(x, 1, 1) plt.plot(x, y, 'g', label='mu = 1,sigma = 1') plt.legend() plt.grid() plt.show()
junxnone/tech-io#684 junxnone/tech-io#809
Gaussian Distribution 高斯分布
μ=0 σ=1
时为 标准正态分布定义
若随机变量 X 密度函数为:
则称随机变量 X 服从正态分布 X ~ (μ,σ2)
多维高斯分布
Python Code
Reference