资源简介
高斯混合模型可以拟合任意数据,本程序就音频数据建立高斯混合模型,内附详细代码,以及经典pdf资料讲解。
代码片段和文件信息
function [Priors Mu Sigma] = EM_GMM(Data nbStates Stop_criterion)
% Inputs ----------------------------------------------------------------------------------
% Data: D x N array representing N datapoints of D dimensions.
% nbStates: Number K of GMM components.
% Stop_criterion: Stopping criterion 1 or 2.
% Outputs ---------------------------------------------------------------------------------
% Priors: 1 x K array representing the prior probabilities of the K GMM components.
% Mu: D x K array representing the centers of the K GMM components.
% Sigma: D x D x K array representing the covariance matrices of the K GMM components.
%------------------------------------------------------------------------------------------
%The iteration stop condition of EM
%EM 迭代停止条件
loglik_threshold = 1e-10;
loglik_old = -realmax;
Epsilon = 0.0001;
nbStep = 0;
[nbVarnbData] = size(Data); %nbVar:The dimensions of the feature;; nbData:The number of points(samples)
%Initialization parameter based on k-means
%初始参数由k-means(其实也是一种特殊的高斯混合模型)决定
[Priors0 Mu0 Sigma0] = EM_init_kmeans(Data nbStates);
Mu = Mu0;
Sigma = Sigma0;
Priors = Priors0;
while (nbStep<1200)
nbStep = nbStep+1;
% E-step------------------------------------------------
for i=1:nbStates
%Compute probability p(x|i)
Pxi(:i) = gaussPDF(Data Mu(:i) Sigma(::i));
end
%Compute posterior probability p(i|x)
Pix_tmp = repmat(Priors[nbData 1]).*Pxi;
Pix = Pix_tmp ./ (repmat(sum(Pix_tmp2)[1 nbStates])+realmin);
%Compute cumulated posterior probability
E = sum(Pix);
% M-step------------------------------------------------
for i=1:nbStates
%Update the priors
Priors(i) = E(i) / nbData;
%Update the centers
Mu(:i) = Data*Pix(:i) / E(i);
%Update the covariance matrices
Data_tmp1 = Data - repmat(Mu(:i)1nbData);
Sigma(::i) = (repmat(Pix(:i)‘nbVar 1) .* Data_tmp1*Data_tmp1‘) / E(i);
% Add a tiny variance to avoid numerical instability
Sigma(::i) = Sigma(::i) + 1E-5.*diag(ones(nbVar1));
end
if Stop_criterion == 1
% Stopping criterion 1
for i=1:nbStates
%Compute the new probability p(x|i)
Pxi(:i) = gaussPDF(Data Mu(:i) Sigma(::i));
end
%Compute the log likelihood
F = Pxi*Priors‘;
F(find(F loglik = mean(log(F));
%Stop the process depending on the increase of the log likelihood
if abs((loglik/loglik_old)-1) < loglik_threshold
break;
end
loglik_old = loglik;
elseif Stop_criterion == 2
% Stopping criterion 2
v = [sum(abs(Mu-Mu0))abs(Priors-Priors0)];
s = abs(Sigma-Sigma0);
v2=0;
for i = 1:nbStates
v2 = v2 + det(s(::i));
end
if (
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3255 2016-03-25 15:10 EM_GMM.m
文件 1588 2016-03-25 14:01 EM_init_kmeans.m
文件 738 2016-03-25 13:56 gaussPDF.m
文件 537600 2012-03-30 14:55 GMM建模与EM算法.ppt
文件 3585734 2016-03-25 15:24 MFCC_features.mat
文件 217660 2012-03-29 19:01 高斯混合模型讲解.pdf
相关资源
- 高斯混合模型提取背景matlabcode
- 基于高斯混合模型GMM的说话人识别实
- 机器学习高斯混合模型资料总结含m
- 高斯混合模型EM算法Matlab代码
- EM算法在高斯混合模型中的应用有ma
- 基于matlab上实现高斯混合模型说话人
- GMM-matlab
- 高斯混合模型matlab实现
- GMM的matlab实现集合
- 高斯混合模型的后验概率代码
- 高斯混合模型GMM 及高斯混合回归MAT
- 高斯混合模型说话人识别
- GMMP SkinColor
- 高斯混合模型(GMM)
- GMM 本代码建立高斯混合模型(高斯多
- 高斯混合模型matlab
- 高斯混合模型matlab代码
- 二维高斯混合模型GMM图形化简单明了
- 高斯混合模型,算法
评论
共有 条评论