0

I'm estimating the parameters of a GMM using EM,

When I use my Matlab script And run the EM code i get a single value of "log-likelihood"..

However in opencv the output of EM.train gives a matrix which contained the loglikelihood value of every sample.

How do I get a single log likelihood value? Do I need to take the minimum of all the loglikelihood values of all samples or the sum of all loglikelihood values?

Alex Riley
  • 169,130
  • 45
  • 262
  • 238
ashwin shanker
  • 303
  • 1
  • 7
  • 20

1 Answers1

0

You need sum of log probabilities of datapoints which you use to estimate probability density function. You'll get loglikelihood of your estimation.

You can find good explanation in "Pattern Recognition and Machine Learning" book

Andrey Smorodov
  • 10,649
  • 2
  • 35
  • 42
  • @AndreySmorodov.. Im having a bit of a trouble here-the book isnt helping me too much either...EM.train outputs a "loghood" matrix which is of dimension (no_of_samples*1) and a "probs" matrix which is (no_of_samples*no_of_components).....when you mean "probabilities of datapoints" Im guessing I should use the "probs" matrix and sum all the log values in it? – ashwin shanker Dec 31 '13 at 03:52
  • You can compute loglikelihood as described here: http://www.schraudolph.org/teach/ml03/MLmix.pdf but as I know, loglikelihood value cares no userful information, it used for optimization purpose only. For finding mu, or sigma for example. And it evaluated for training set, not for each example. No, I didn't mean probs matrix values, it contains probs for posterior probabilities of each Gaussian mixture component you need probability for etire pdf you estimate. – Andrey Smorodov Dec 31 '13 at 10:12
  • By the way, I've just look at opencv's EM source, there is line: trainLogLikelihood = sum(trainLogLikelihoods)[0]; I think this is the answer you looking for. You need sum values of loglikelihood matrix. – Andrey Smorodov Dec 31 '13 at 10:24