0

为了简化我的问题,我在这里创建了一个虚拟问题:我有两组训练数据,分别标记为 1 和 2。两个训练数据集都假设遵循混合高斯分布。我可以轻松地使用 Matlab 工具箱函数 (gmdistribution.fit) 来估计它们的均值和协方差。

然后我有一些测试数据集,假设是使用类似于训练数据集 2 的 MoG 创建的,但有噪声。我想计算我的测试数据集更有可能使用训练数据集 2 的 MoG 生成的似然概率。换句话说,我想获得我的测试数据集具有标签 2 的可能性。

您能否指出如何做到这一点的方向?非常感谢。

注意:

  1. 我的两个训练数据集的大小不同
  2. 两个训练数据集的分布是重叠的。
  3. 测试数据集的大小远小于训练数据集。

一些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, '.')
4

1 回答 1

0

我觉得AIC和BIC很方便。

尝试“struct(MoGObj2)”以获得适合您的领域的理想选择。

其中之一是 NLogL,它是对数似然的负数。我想这就是你要找的。

http://www.mathworks.com/help/stats/gmdistributionclass.html

祝你好运

于 2014-02-25T17:59:59.010 回答