高斯混合模型Gaussian Mixture Model) 和 期望最大化算法(expectation-maximization)用matlab问题 200
RunTestGMM2DProject.mtogettwodifferentGaussiandistributionsinthe2Dcoordinate.Complete...
Run TestGMM2DProject.m to gettwo different Gaussian distributions in the 2D coordinate. Complete steps 2, 3,and 4 to estimate 2D GMM using the EM algorithm. The result should contain the following result.
TestGMM2DProject.m 150407
closeall,clear all,clc
Generate two Gaussian distributions for the training set
Mu1=[1 2]; Sigma1 = [ 3 .2;.2 2]; N1 = 200; % mean, covariance, # of points.
Mu2 = [-1 -2]; Sigma2 = [2 0;0 1]; N2 = 100; % mean, covariance, # ofpoints.
% Generate sample points with the specified meansand covariance matrices.
R1=chol(Sigma1); x1=randn(N1,2)*R1;x1=x1+repmat(Mu1,size(x1,1),1); R2=chol(Sigma2); x2=randn(N2,2)*R2;x2=x2+repmat(Mu2,size(x2,1),1); X = [x1; x2]; figure(1);
% Display a scatter plot ofthe two distributions.hold off;plot(x1(:,1),x1(:,2),'bo');hold on;plot(x2(:,1),x2(:,2),'ro');
% First, create a [10,000 x 2] matrix 'gridX' ofcoordinates representing
% the input values over thegrid.
gridSize = 100; u =linspace(-6,6,gridSize); [A B] = meshgrid(u, u); gridX = [A(:), B(:)]; % Calculate the Gaussian response for every value in the grid.
g1Train= gaussianND(gridX,Mu1,Sigma1); g2Train= gaussianND(gridX,Mu2,Sigma2);
% Reshape the responses backinto a 2D grid to be plotted with contour.
Z1=reshape(g1Train,gridSize,gridSize);
Z2=reshape(g2Train,gridSize,gridSize);
% Plot the contour lines toshow the pdf over the data.
[C, h] = contour(u, u, Z1); [C, h] = contour(u, u, Z2); axis([-6 6 -66]) title('Original Data and PDFs');
上面的是作业的内容 本人看不懂英语也不太懂matlab
下面就是作业的主题
STEP 2: Initializethe parameters.
STEP 3: RunExpectation Maximization
STEP 4: Displaythe two estimated Gaussian distributions
STEP 1是能运行上面代码(完善)就行
下面网盘 作业相关的都在这。
http://pan.baidu.com/s/1c0hdRwc
做完后在这贴或发都行。
今早上课明天得交 我自认为工学和英语不擅长。
我先多谢了。附带一些说明 起码后期学学。 我也尽量做看看。
46944110@qq.com
找到代码 能否解释代码?解释顺便带公式。
https://chrisjmccormick.wordpress.com/2014/08/04/gaussian-mixture-models-tutorial-and-matlab-code/ 展开
TestGMM2DProject.m 150407
closeall,clear all,clc
Generate two Gaussian distributions for the training set
Mu1=[1 2]; Sigma1 = [ 3 .2;.2 2]; N1 = 200; % mean, covariance, # of points.
Mu2 = [-1 -2]; Sigma2 = [2 0;0 1]; N2 = 100; % mean, covariance, # ofpoints.
% Generate sample points with the specified meansand covariance matrices.
R1=chol(Sigma1); x1=randn(N1,2)*R1;x1=x1+repmat(Mu1,size(x1,1),1); R2=chol(Sigma2); x2=randn(N2,2)*R2;x2=x2+repmat(Mu2,size(x2,1),1); X = [x1; x2]; figure(1);
% Display a scatter plot ofthe two distributions.hold off;plot(x1(:,1),x1(:,2),'bo');hold on;plot(x2(:,1),x2(:,2),'ro');
% First, create a [10,000 x 2] matrix 'gridX' ofcoordinates representing
% the input values over thegrid.
gridSize = 100; u =linspace(-6,6,gridSize); [A B] = meshgrid(u, u); gridX = [A(:), B(:)]; % Calculate the Gaussian response for every value in the grid.
g1Train= gaussianND(gridX,Mu1,Sigma1); g2Train= gaussianND(gridX,Mu2,Sigma2);
% Reshape the responses backinto a 2D grid to be plotted with contour.
Z1=reshape(g1Train,gridSize,gridSize);
Z2=reshape(g2Train,gridSize,gridSize);
% Plot the contour lines toshow the pdf over the data.
[C, h] = contour(u, u, Z1); [C, h] = contour(u, u, Z2); axis([-6 6 -66]) title('Original Data and PDFs');
上面的是作业的内容 本人看不懂英语也不太懂matlab
下面就是作业的主题
STEP 2: Initializethe parameters.
STEP 3: RunExpectation Maximization
STEP 4: Displaythe two estimated Gaussian distributions
STEP 1是能运行上面代码(完善)就行
下面网盘 作业相关的都在这。
http://pan.baidu.com/s/1c0hdRwc
做完后在这贴或发都行。
今早上课明天得交 我自认为工学和英语不擅长。
我先多谢了。附带一些说明 起码后期学学。 我也尽量做看看。
46944110@qq.com
找到代码 能否解释代码?解释顺便带公式。
https://chrisjmccormick.wordpress.com/2014/08/04/gaussian-mixture-models-tutorial-and-matlab-code/ 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏200(财富值+成长值)
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询