[Topic-models] NaN (not a number) problem in Supervised topic model
benwing at mail.utexas.edu
Fri May 16 17:42:48 EDT 2008
NaN typically occurs when you do 0/0 or -INF + INF or something like
this. if you do some operation (e.g. division by zero or log of zero)
that results in +INF or -INF, you can easily get NaN when you do
further work with this. a NaN log-likelihood might result from some
earlier operation where you did log(0) due to underflow or something.
there is probably a way in MATLAB to tell it to throw an error
whenever you generate INF of NaN. you can do this in C like this:
On Fri, May 16, 2008 at 11:13 AM, David Blei <blei at cs.princeton.edu> wrote:
> hi kevin,
> typically, asserts don't indicate problems. they are used to find and
> diagnose them. if the likelihood ever is NaN then i want the program to
> stop running because there is something seriously wrong.
> i'm not sure what your problem might be, but the likelihood should not be
> On May 15, 2008, at 11:44 PM, kevin chen 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
>> Interestingly, there is also a NaN check in Blei's code of LDA:
>> So is it a general problem in topic model related program?
>> Thank you in advance.
>> Topic-models mailing list
>> Topic-models at lists.cs.princeton.edu
> Topic-models mailing list
> Topic-models at lists.cs.princeton.edu
More information about the Topic-models