bayesnet / bnt

Bayes Net Toolbox for Matlab
469 stars 247 forks source link

Wrong assert in HMM/fwdback.m #53

Open giampierosalvi opened 7 years ago

giampierosalvi commented 7 years ago

Hi, the function fwdback in HMM/fwdback.m has an option "scaled" to scale alpha and beta probabilities to avoid numerical problems with long sequences. If this option is set to false, alpha(h,t) is the probability of observing the sequence up to time t and being in state h at time t. The sum of those probabilities with respect to the states (sum(alpha(:,t))) is not supposed to be 1, but rather the probability (or likelihood) of the observation sequence up to time t. Consequently the assert statements at line 105 and 125 fail always if running with scaled=false.

The assert statements should either be removed, or moved into the "if scaled" statements (however, they are not necessary there, given the call to normalise).

Best Giampiero