您的位置:首页 > 编程语言 > Go语言

EM 算法

2015-03-24 21:26 232 查看
1.      AlgorithmTheory

1.1.    EMAlgorithm

Suppose we have an estimation problem in which we have a training set

.We
wish to fit the parameters of a model  to the data, where the likelihood is given by


                                 
       (1)
Because explicitly finding the maximum likelihood estimates of the parameter  may be hard, we choose EM algorithm as an efficient method for MLE. The algorithm is as follows:

Repeat until convergence{

(E-step)For each , set


                                 
       (2)
(M-step)Set


                        
(3)
}

1.2.    EMalgorithm in image segmentation

原谅我在此处用中文继续:

我们将输入的图片数据视作Mixture of Gaussian:



对于输入的数据,我们可以得到其直方图分布,我们欲对这个灰度值进行聚类(注意到聚类算法是逐灰度值处理的)。设我们要分为k类,则有个k个Gaussian分布。

在初始化的过程中,由图像数据我们可以得到



至此我们可以求得初始化下的一个似然函数(即公式(1)),之后我们希望这个似然函数的值在迭代中不断增大,直至收敛。

因此,在迭代中,我们选择:



由上,将分布参数在迭代过程中不断改动,则值增大。

我们记为新分布下的似然函数值。则



当两者差值足够小时,收敛。

这时大家应该发现了一个问题,如果我们按上表中Code部分计算,那么输入图像中出现1个255和出现n个255,迭代结果是一样的。这是错误的。原因在于我们没有统计各数字(灰度值)出现的频率。为了修正这个错误,我们在执行EM过程中,应在概率项前乘以“直方图分布”系数,即



2.     Technological process



3.     Experiment Results

clc
clear all;
img = imread('brainweb91.tif');
img = rgb2gray(img);
k = 4;
[mask,mu,v,p]=dcEMimSeg(img,k);
figure,imshow(img),title('读入原图像');
figure,imshow(mask./3),title('EMclustering结果');
img2 = uint8(mask./3);
[ri,gce,vi] = compare_segmentations(img,img2);
ri
gce
vi


ri = 0.6447
gce = 0
vi = 4.5362

Published with MATLAB? R2014a


4.     Compareto MICO

 

EM algorithm

MICO

ri (Probabilistic Rand Index)

0.6447

0.9942

gce (Global Consistency Error)

0

0.5791

vi (Variation of Information)

4.5362

6.0720

5.     Reference

[1]. A Tutorialon Clustering Algorithms,http://home.deib.polimi.it/matteucc/Clustering/tutorial_html/mixture.html.
[2]. CS229Lecture notes, Andrew Ng,Notes8.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息