hmmdecode() seems to return NaN if there are 0's (or near 0's like 1e-100) in the TR or EMIT model matrices. This maybe be a bit of a hack but this should get you around it (and it's a cool use of logical indices):
min = 1e-10 % choose a small non-zero value
TR ( TR < min) = min
EMIT ( EMIT < min) = min
Lee
"Puntis " <p_J_haghighi@yahoo.com> wrote in message <h8c6gj$rii$1@fred.mathworks.com>...
> Rune Allnor <allnor@tele.ntnu.no> wrote in message <5ecffd50-4e51-4816-8a11-349ce38d9331@r39g2000yqm.googlegroups.com>...
> > On 10 Sep, 12:35, "Puntis " <p_J_haghi...@yahoo.com> wrote:
> > > I work on a word recognition system and I use Matlab HMM functions to train and test my system.For testing I use hmmdecode function and it gives me NAN value as loglikelihood for all the classes which doesn't make sense.I'm wondering if anyone could help me to solve this problem.
> >
> > What is the problem? That the function return NaN? Or that
> > the input data don't make sense? Or that the function returns
> > NaN for the input data that don't make sense?
> >
> > Rune
>
>
> Hi Rune,
>
> As you see, [PSTATES,logpseq] = hmmdecode(seq,TRANS,EMIS), hmmdecode returns logpseq, the logarithm of the probability of sequence seq, given transition matrix TRANS and emission matrix EMIS. So I gave the matrices and the testing seq to the function and as the logpseq it returns NAN value while it should return a value which should probably be a very small value.
>
> Thanks,
>
> Puntis
min = 1e-10 % choose a small non-zero value
TR ( TR < min) = min
EMIT ( EMIT < min) = min
Lee
"Puntis " <p_J_haghighi@yahoo.com> wrote in message <h8c6gj$rii$1@fred.mathworks.com>...
> Rune Allnor <allnor@tele.ntnu.no> wrote in message <5ecffd50-4e51-4816-8a11-349ce38d9331@r39g2000yqm.googlegroups.com>...
> > On 10 Sep, 12:35, "Puntis " <p_J_haghi...@yahoo.com> wrote:
> > > I work on a word recognition system and I use Matlab HMM functions to train and test my system.For testing I use hmmdecode function and it gives me NAN value as loglikelihood for all the classes which doesn't make sense.I'm wondering if anyone could help me to solve this problem.
> >
> > What is the problem? That the function return NaN? Or that
> > the input data don't make sense? Or that the function returns
> > NaN for the input data that don't make sense?
> >
> > Rune
>
>
> Hi Rune,
>
> As you see, [PSTATES,logpseq] = hmmdecode(seq,TRANS,EMIS), hmmdecode returns logpseq, the logarithm of the probability of sequence seq, given transition matrix TRANS and emission matrix EMIS. So I gave the matrices and the testing seq to the function and as the logpseq it returns NAN value while it should return a value which should probably be a very small value.
>
> Thanks,
>
> Puntis