peiguangjing / pmtk3

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

hmmFitEm can crash with discrete observations r2055 #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set len to 101 in hmmDiscreteFitTest
2. Run the demo

From Nachi Sahoo:

hmmFitEM.m, line 207-209: it is relying on a hard clustering
assignment to initialize transition probability matrix. Sometimes the
initial clustering gets a fewer number of clusters than the number of
states in hmm. So, the transition probability matrix formed on line
209 is smaller than it should be. One way to fix it is to change line
209 from
        A      = accumarray([z(1:end-1), z(2:end)], 1);
to
        A      = accumarray([z(1:end-1), z(2:end)], 1, [nstates,
nstates]);

Since, we'd know the number of states at this point. It ensures that
we'd have the correct sized transition matrix.

Original issue reported on code.google.com by mattbdun...@gmail.com on 8 Aug 2010 at 4:08

GoogleCodeExporter commented 9 years ago

Original comment by mattbdun...@gmail.com on 8 Aug 2010 at 4:09

GoogleCodeExporter commented 9 years ago
this has been fixed in r2056

Original comment by mattbdun...@gmail.com on 8 Aug 2010 at 4:10

GoogleCodeExporter commented 9 years ago

Original comment by mattbdun...@gmail.com on 11 Aug 2010 at 1:53