我目前正试图制作一些情节,表明GMM比MNN(多模型正态分布)更擅长建模数据,但不能制作两者都适合的情节。这是我目前的代码:
MU1 = [1 2];
SIGMA1 = [2 0; 0 .5];
MU2 = [4 6];
SIGMA2 = [1 0; 0 1];
rng(1); % For reproducibility
X = [mvnrnd(MU1,SIGMA1,1000);
mvnrnd(MU2,SIGMA2,1000)];
figure;
scatter(X(:,1),X(:,2),10,'.')
options = statset('Display','final');
gm = fitgmdist(X,2,'Options',options); % GMM fit
G = fitgmdist(X,1) % fit MNN - only 1 component are being used
gmPDF = @(x,y)pdf(gm,[x y]);
F = @(x,y) pdf(G,[x y])
hold on
%h = ezcontour(gmPDF,[-3 10],[-3 10]);
d = ezcontour(F,[-3 10],[-3 10]);
title('Scatter Plot and PDF Contour')
hold off
%%
close all
我能够看到这些情节,但我可以以某种方式打印两者的准确性吗? 像异常值或其他东西的东西?