代码拉取完成,页面将自动刷新
Gaussian Mixture Models in Python
Author: Jeremy Stober
Contact: stober@gmail.com
Version: 0.01
This is a standalone Pythonic implementation of Gaussian Mixture
Models. Various initialization strategies are included along with a
standard EM algorithm for determining the model parameters based on
data.
Example code for the GMM and Normal classes can be found in the
src/test_*.py files. The GMM and the underlying Normal class both
support conditioning on data and marginalization for any subset of the
variables. This makes this implementation ideal for experimenting with
Gaussian Mixture Regression. For example, the following code learns
the cosine function:
import numpy as np
from gmm import GMM
from plot_gmm import draw2dgmm
from test_func import noisy_cosine
import pylab as pl
x,y = noisy_cosine()
data = np.vstack([x,y]).transpose()
pl.scatter(data[:,0],data[:,1])
gmm = GMM(dim = 2, ncomps = 2, data = data, method = "kmeans")
draw2dgmm(gmm)
nx = np.arange(0,2 * np.pi, 0.1)
ny = []
for i in nx:
ngmm = gmm.condition([0],[i])
ny.append(ngmm.mean())
pl.plot(nx,ny,color='red')
pl.show()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。