(minor) bug in HMM::forwardbackward (fixed in V3.04)


Bill Press
08-17-2010, 03:56 PM
In forwardbackward(), the line
while (lhood < BIGI) {lhood *= BIG; lrnrm++;}
should be replaced by
if (lhood != 0.) while (lhood < BIGI) {lhood *= BIG; lrnrm++;}
This prevents an infinite loop in the pathological and rare case that the likelihood lhood is exactly zero. (Note that, in this case, a subsequent call to HMM::loglikelihood() will produce an error, as it should.) Thanks to user tbegg for pointing this out.