gorillayue / pmtk3

Automatically exported from code.google.com/p/pmtk3
MIT License
0 stars 0 forks source link

hmmLogprob greater than zero #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Fully  defined a HMM (hmmCreate)
2. Sampled training and test data  (hmmSample)
3. Trained a HMM (hmmFit)
4. Tested HMM (hmmLogprob)
-> Got a log likelihood greater than zero.

Things that look weird:

The state-transition matrix A of the trained model is not normalized: 
normalize(model.A)-model.A should be zero(..).

Could also be a numerical over-/underflow issue: I am using relative long 
sequencces.

Or my sampling HMM could be crap:

%d=1
nstates = 7;
pi = [1 0 0 0 0 0 0];
A = normalize(diag(ones(nstates, 1)) + ...
            diag(ones(nstates-1, 1), 1), 2);
sigma = [[0.05],[0.05],[0.05],[0.05],[0.05],[0.05],[0.05]];
mu = [0.7, 1.4, 2.1, 2.8, 3.5, 4.2, 4.9];
emission = condGaussCpdCreate(mu, sigma);

modelValid = hmmCreate('gauss', pi, A, emission);

What is the expected output? What do you see instead?
The log of a probality can't be greater than zero.

What version / revision of the product are you using? On what operating
system?
MATLAB 2009a

Please provide any additional information below.

Original issue reported on code.google.com by business...@gmail.com on 15 Nov 2010 at 9:46

Attachments:

GoogleCodeExporter commented 9 years ago
State-transion matrix of the trained model is normalized. Re-checked my 
results, but the logprob is positive in one case.

Original comment by business...@gmail.com on 3 Dec 2010 at 9:22

GoogleCodeExporter commented 9 years ago
Probability density functions (eg Gaussian) can be > 1
(eg normpdf(0, 0,   0.9/sqrt(2*pi))
Try MAP estimation to regularize things. See discussion on pmtk list Feb 2011.

Original comment by murphyk2 on 28 Feb 2011 at 7:44

GoogleCodeExporter commented 9 years ago

Original comment by murphyk2 on 16 May 2013 at 4:17