One difference here from the original IFS algorithm is that we adopt a technique in (Goodman, 2002) for optimizing the parameters in the conditional ME training.
we use array z to store the normalizing factors, and array sum for all the un-normalized conditional probabilities sum [i, y].