我想在 Python 中构造和 1D 绘制一个单变量高斯混合,其中包含三个分量,其中我已经有了它的参数,包括 mu、sigma、mix 系数。
我所追求的在 MATLAB 中有一个等价物,即 gmdistribution(mu,sigma,p)
我认为代码应该是这样的:
from numpy import *
from matplotlib.pylab import *
from sklearn import mixture
gmm = mixture.GMM(n_components=3)
gmm.means_ = np.array([[-1], [0], [3]])
gmm.covars_ = np.array([[1.5], [1], [0.5]]) ** 2
gmm.weights_ = np.array([0.3, 0.5, 0.2])
fig = plt.figure(figsize=(5, 1.7))
ax = fig.add_subplot(131)
#ax.plot(gmm, '-k')
想知道怎么做...
干杯