当前位置:   article > 正文

gmm 高斯 matlab,高斯混合模型GMM实现 matlab

gmm高斯混合模型用什么软件实现

a63ae13841c450763b0454bb979615f7.png

(1)以下matlab代码实现了高斯混合模型:

function [Alpha, Mu, Sigma] = GMM_EM(Data, Alpha0, Mu0, Sigma0)

%% EM 迭代停止条件

loglik_threshold = 1e-10;

%% 初始化参数

[dim, N] = size(Data);

M = size(Mu0,2);

loglik_old = -realmax;

nbStep = 0;

Mu = Mu0;

Sigma = Sigma0;

Alpha = Alpha0;

Epsilon = 0.0001;

while (nbStep < 1200)

nbStep = nbStep+1;

%% E-步骤 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for i=1:M

% PDF of each point

Pxi(:,i) = GaussPDF(Data, Mu(:,i), Sigma(:,:,i));

end

% 计算后验概率 beta(i|x)

Pix_tmp = repmat(Alpha,[N 1]).*Pxi;

Pix = Pix_tmp ./ (repmat(sum(Pix_tmp,2),[1 M])+realmin);

Beta = sum(Pix);

%% M-步骤 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for i=1:M

% 更新权值

Alpha(i) = Beta(i) / N;

% 更新均值

Mu(:,i) = Data*Pix(:,i) / Beta(i);

% 更新方差

Data_tmp1 = Data - repmat(Mu(:,i),1,N);

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/在线问答5/article/detail/920140
推荐阅读
相关标签
  

闽ICP备14008679号