Matlab 中缺失数据的期望最大化

发布于 2024-12-02 21:48:28 字数 187 浏览 1 评论 0原文

我必须使用EM来估计两个类中每个类的高斯分布的均值和协方差。他们也有一些缺失的属性。

每个对象的类是已知的。因此,问题基本上简化为拟合缺失元素的高斯模型。

哪个是最好使用的库?

ECM算法与EM算法有何不同?

I have to use EM to estimate the mean and covariance of the Gaussian distribution for each of the two classes. They have some missing attributes too.

Classes of each object is known. Therefore the problem basically reduces to fitting a gaussian model with missing element.

Which is the best library to use?

How is ECM Algorithm different from EM algorithm?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

电影里的梦 2024-12-09 21:48:28

如果您有权访问统计工具箱,则可以使用 GMDISTRIBUTION使用 EM 算法拟合高斯混合模型的类。

这是一个示例:

%# sample dataset
load fisheriris
data = meas(:,1:2);
label = species;

%# fit GMM using EM
K = 2;
obj = gmdistribution.fit(data, K);

%# assign points to mixtures: argmax_k P(M(k)|data)
P = posterior(obj, data);
[~,mIDX] = max(P,[],2);

%# GMM components
obj.mu             %# means
obj.Sigma          %# covariances
obj.PComponents    %# mixture weights

%# visualize original data clusters
figure
gscatter(data(:,1), data(:,2), label)

%# visualize mixtures found
figure
gscatter(data(:,1), data(:,2), mIDX), hold on
ezcontour(@(x,y)pdf(obj,[x y]), xlim(), ylim())

在此处输入图像描述

如果没有,请查看优秀的 Netlab Toolbox,因为它具有 GMM 实现。

If you have access to the Statistics Toolbox, you can use the GMDISTRIBUTION class to fit a Gaussian Mixture Model using the EM algorithm.

Here is an example:

%# sample dataset
load fisheriris
data = meas(:,1:2);
label = species;

%# fit GMM using EM
K = 2;
obj = gmdistribution.fit(data, K);

%# assign points to mixtures: argmax_k P(M(k)|data)
P = posterior(obj, data);
[~,mIDX] = max(P,[],2);

%# GMM components
obj.mu             %# means
obj.Sigma          %# covariances
obj.PComponents    %# mixture weights

%# visualize original data clusters
figure
gscatter(data(:,1), data(:,2), label)

%# visualize mixtures found
figure
gscatter(data(:,1), data(:,2), mIDX), hold on
ezcontour(@(x,y)pdf(obj,[x y]), xlim(), ylim())

enter image description here

If not, check out the excellent Netlab Toolbox, as it has GMM implementation.

断爱 2024-12-09 21:48:28

谢谢大家。但我正在使用 ecmnmle估计参数,然后获取 marginals 稍后在贝叶斯分类中使用。它在 2 个类别上的准确率分别为 0.9 和 0.69,效果非常好。

Thanks all.But I am using ecmnmle for estimating parameters and then obtaining distribution of marginals which is used later in bayes classification. It works pretty fine with accuracies of 0.9 and 0.69 on 2 classes.

上课铃就是安魂曲 2024-12-09 21:48:28

请查看 PMTK工具包

这是EM 实现(适合混合高斯分布,其中数据可能有 NaN 条目)

Please take a look at the PMTK toolkit

Here is the EM implementation (Fit a mixture of Gaussians where the data may have NaN entries)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文