[Topic-models] NaN (not a number) problem in Supervised topic model

Chong Wang mr.chongwang at gmail.com
Fri May 16 11:41:17 EDT 2008

it might a bug of numerical computing: such as log(0) and exp(a huge value).
If it is not a bug of the program, the input value should be checked for
log(x), when x can be zero. for e.g. if (x>0) return log(x); else return


On Thu, May 15, 2008 at 11:44 PM, kevin chen <kchsjtu at yahoo.com> wrote:

> Dear all,
> I am implementing "Supervised topic model" in Matlab language, following
> the paper by Blei and McAuliffe.
> I encounter a problem: after about 30 iterations of EM (corpus level), the
> per-document log-likelihood becomes NaN (Not a number).
> In my code, the vbem (document level) iterates for 200 times without
> convergence analysis. Is NaN problem due to too many vbem iteration times?
> I have checked my code for several times, and couldn't find out how to fix
> it.
> Interestingly, there is also a NaN check in Blei's code of LDA:
> assert(!isnan(likelihood));
> So is it a general problem in topic model related program?
> Thank you in advance.
> Best,
> Kevin
> _______________________________________________
> Topic-models mailing list
> Topic-models at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/topic-models

Chong Wang
chongw at cs.princeton.edu
Computer Science Department
Princeton University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/topic-models/attachments/20080516/39ba2f0f/attachment.htm>

More information about the Topic-models mailing list