为了简化我的问题,我在这里创建了一个虚拟问题:我有两组训练数据,分别用1和2标记。假设两个训练数据集都遵循高斯分布的混合。我可以轻松使用Matlab工具箱函数(gmdistribution.fit)来估计它们的均值和协方差。
然后我有一些测试数据集,假设用类似于训练数据集2的MoG创建,但是有噪声。我想计算类似于使用训练数据集2的MoG更可能生成测试数据集的可能性概率。换句话说,我希望我的测试数据集具有标签2的可能性。 / p>
请指点一下如何做到这一点?非常感谢。
N.B:
一些Matlab代码:
%% Mixture of Gassian 1 (Training set 1)
mean1 = [1 -2];
cov1 = [2 0; 0 .5];
mean2 = [0.5 -5];
cov2 = [1 0; 0 1];
trainingDataset1 = [mvnrnd(mean1, cov1, 1000); mvnrnd(mean2, cov2, 1000)];
MoGOptions = statset('Display', 'final');
MoGObj1 = gmdistribution.fit(trainingDataset1, 2, 'Options', MoGOptions);
figure,
scatter(trainingDataset1(:,1), trainingDataset1(:,2), 10, '.')
hold on
ezcontour(@(x,y)pdf(MoGObj1,[x y]), [-8 6], [-8 2]);
%% Mixture of Gassian 2 (Training set 2)
mean4 = [0.5 -1];
cov4 = [1.5 0; 0 .8];
mean5 = [-2 -3];
cov5 = [1 0; 0 1];
mean6 = [-4 -2];
cov6 = [1 0; 0 1];
trainingDataset2 = [mvnrnd(mean4, cov4, 500); mvnrnd(mean5, cov5, 500); mvnrnd(mean6, cov6, 500)];
MoGOptions = statset('Display', 'final');
MoGObj2 = gmdistribution.fit(trainingDataset2, 2, 'Options', MoGOptions);
figure,
scatter(trainingDataset2(:,1), trainingDataset2(:,2), 10, '.')
hold on
ezcontour(@(x,y)pdf(MoGObj2,[x y]), [-8 6], [-8 2]);
%% Test set
mean7 = [1.1 -2.1];
cov7 = [2.2 0; 0 .4];
mean8 = [0.3 -5.4];
cov8 = [1.2 0; 0 1.1];
testingDataset1 = [mvnrnd(mean7, cov7, 100); mvnrnd(mean8, cov8, 100)];
figure,
scatter(testingDataset1(:,1), testingDataset1(:,2), 10, '.')
答案 0 :(得分:0)
我发现AIC和BIC非常方便。
尝试“struct(MoGObj2)”来获得适合你的领域的理想。
其中一个是NLogL,它是对数似然的负数。我认为这就是你要找的东西。
http://www.mathworks.com/help/stats/gmdistributionclass.html
祝你好运