大工至善|大学至真分享 http://blog.sciencenet.cn/u/lcj2212916

博文

[转载]【源码】高斯混合模型的EM算法(EM GMM)

已有 3126 次阅读 2019-1-3 09:14 |系统分类:科研笔记|文章来源:转载


该软件包采用期望最大化(EM)算法拟合高斯混合模型(GMM),适用于任意维的数据集。

This package fits Gaussian mixture model (GMM) by expectation maximization (EM) algorithm.It works on data set of arbitrary dimensions. 


在计算高维数据概率时,为了避免经常出现的浮点数下溢现象,采用了对数域计算概率等方法来提高数值稳定性

Several techniques are applied to improve numerical stability, such as computing probability in logarithm domain to avoid float number underflow which often occurs when computing probability of high dimensional data. 


该代码经过了精心设计,以利用向量化和矩阵分解来提高计算效率。

The code is also carefully tuned to be efficient by utilizing vertorization and matrix factorization.


这种算法被广泛使用。具体细节可以在教科书“模式识别与机器学习”或wiki页面中找到。

This algorithm is widely used. The detail can be found in the great textbook "Pattern Recognition and Machine Learning" or the wiki page 

http://en.wikipedia.org/wiki/Expectation-maximization_algorithm


该函数是鲁棒且高效的,但是代码结构是经过特别组织的,以便于阅读。请尝试使用以下代码进行演示:

This function is robust and efficient yet the code structure is organized so that it is easy to read. Please try following code for a demo: 


close all; clear; 

d = 2; 

k = 3; 

n = 500; 

[X,label] = mixGaussRnd(d,k,n); 

plotClass(X,label);


m = floor(n/2); 

X1 = X(:,1:m); 

X2 = X(:,(m+1):end); 

% train 

[z1,model,llh] = mixGaussEm(X1,k); 

figure; 

plot(llh); 

figure; 

plotClass(X1,z1); 

% predict 

z2 = mixGaussPred(X2,model); 

figure; 

plotClass(X2,z2);


源码下载地址:

http://page5.dfpan.com/fs/7lac2j2232d16229169/


更多精彩文章请关注微信号:qrcode_for_gh_60b944f6c215_258.jpg




https://blog.sciencenet.cn/blog-69686-1155065.html

上一篇:[转载]【Tom M. Mitchell课件】机器学习习题、解答及源代码(第三套)
下一篇:[转载]【新书推荐】【2019.10】货币交易入门:在今日市场与伙伴网站中胜出
收藏 IP: 222.190.121.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-10-19 21:34

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部