Baum-Welch Learner and Zero Probabilities

104 views
Skip to first unread message

Sadegh Dorri N.

unread,
Sep 12, 2011, 6:42:26 AM9/12/11
to jahmm-...@googlegroups.com
Dear all,

I think the BaumWelch learner and consequently its scaled version work incorrectly in face of zero probabilities. As you know floating-point operations are not that much exact, and when comparing with zero, we must be careful about our comparison. For example the following test in BaumWelchLearner.java may not work as expected:

if (aijDen[i] == 0.) // State i is not reachable

Because very small probabilities near zero may escape the check. It's better (and is a good practice) to check for an interval around zero instead. For example:

if (Math.abs(aijDen[i]) < EPSILON)

Another problem is in the computation of pdf's. If it is not probable to be in an state, its sum of weights becomes zero, and dividing them by this value results in NaN for probability distributions. I think a fix may be to check for this condition and leave the distribution unchanged:

// If being in that state is possible, reestimate it. Otherwise, leave it unchanged.
if (Math.abs(sum) > EPSILON) {
    for (j--; j >= 0; j--)
         weights[j] /= sum;
    Opdf<O> opdf = nhmm.getOpdf(i);
    opdf.fit(observations, weights);
}

Kind wishes,
Sadegh
Reply all
Reply to author
Forward
0 new messages