samdon / pmtk3

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

markovFit crashes with multiple observations X(i, :) #24

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.x=[1 2 1 1 2; ...
     2 2 2 2 1; ...
     1 1 1 1 2 ]
2.model=markovFit(x);

What is the expected output? What do you see instead?
>> model.A
ans =
    0.5714    0.4286
    0.4000    0.6000
>> model.pi
ans =
    0.6667    0.3333
===========================but we have
??? Error using ==> plus
Matrix dimensions must agree.

Error in ==> markovFit at 27
model.pi = rowvec(normalize(histc(X(:, 1), 1:nstates)) + rowvec(pseudoCountsPi 
- 1));

What version / revision of the product are you using? On what operating
system?
PMTK (r2774), Matlab

Please provide any additional information below.
I think the simplest way is to change 
model.pi = rowvec(normalize(histc(X(:, 1), 1:nstates)) + rowvec(pseudoCountsPi 
- 1));
to 
model.pi = rowvec(normalize(histc(X(:, 1)', 1:nstates)) + rowvec(pseudoCountsPi 
- 1));

Original issue reported on code.google.com by RA.Dragun on 19 Apr 2011 at 11:54

GoogleCodeExporter commented 9 years ago
Moved to GitHub: https://github.com/probml/pmtk3/issues/24

Original comment by irosen on 4 Jan 2014 at 2:34