使用GMM和MATLAB进行分类 [英] Classify using GMM with MATLAB

查看:550
本文介绍了使用GMM和MATLAB进行分类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用带有MATLAB的高斯混合模型对两个类别进行分类.

I want to perform classification of two classes using Gaussian Mixture Models with MATLAB.

我通过使用gmdistribution.fit函数创建两个模型来进行训练

I doing training by creating two models with the function gmdistribution.fit

NComponents = 1;
  for class=1:2
      model(class).obj =    gmdistribution.fit(trainData(class).feature,NComponents,'Regularize',.1);
  end

然后,给定测试数据点,我想知道如何对其进行分类.我现在要做的是获取每个模型中每个点的后验概率:

Then, given test data points, I want to know how to classify them. What I am doing now is to obtain the posterior probability for each point in each model:

vectorClasses = zeros(1,2);
    for class=1:2
        Pos=  posterior(model(class).obj,testDataPoint);           
         suma=0;
         for k=1:NComponents
             suma = suma + Pos(1,k)*model(class).obj.PComponents(k);
         end
        vectorClasses(class)=suma;
    end
    [v ix] = sort(vectorClasses,'descend');
    if ix(1)==realClass
        success= 1;
    else
        success= 0;
    end

我将每个分量的后验概率与模型中该分量的概率相乘.然后,我对在每个模型中获得的概率进行排序.我说测试数据点与概率最高的类别相对应.

I sum the multiplication of the posterior probability of each component and the probability of the component in the model. Then I sort the probabilities obtained in each model. I say the test data point correspond to the class with the highest probability.

我做得还好吗?正确的方法如何?有最简单的方法吗?

Am I doing it ok? How is the correct way? Is there an easiest way to do it?

推荐答案

似乎不需要像HMM那样在每个类中都具有独立的模型,如以下答案中所述: 此非常完整的描述.与分类阶段类似,后命令似乎可以完成这项工作.但是,该模型似乎没有指示哪个集群代表哪个类(我们必须弄清楚).如果您已获得完整的解决方案,请发布它.关于如何使用matlab的gmm进行分类的信息确实很少(也可以进行搜索).

seems that there is no need to have independent models per class as it would in the case of HMMs, as described in the answer in: this very complete description. Similar for the classification stage, posterior commands seems to do the work. However, it looks like the model does not indicate which cluster represents which class (we have to figure it out). If you have achieved a complete solution please post it. There isn't really much information on how to use matlab's gmm for classification (been searching too).

这篇关于使用GMM和MATLAB进行分类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆