chbrown / slda

Supervised Latent Dirichlet Allocation for Classification
GNU General Public License v2.0
85 stars 25 forks source link

NaN in softmax_f during maximum likelihood estimation #2

Open angeloskath opened 8 years ago

angeloskath commented 8 years ago

The maximization procedure (of the supervised part) after the expectation produces NaN values for our data.

We have traced the issue to opt.cpp lines 78, 142 and 218. a2 is less than 0 and the logarithm produces the NaN values. Since a2 = \eta_k^T Var(\bar Z) \eta_k it makes no sense for it to be negative. Var(\bar Z) should be positive definite since it is the variance matrix.

Is there anything numeric (under-/overflow etc) that could cause this kind of error which you can think of?

chbrown commented 8 years ago

Hi @angeloskath it's been like 3 years since I touched this project, and even then it was kind of an experiment. It's basically just a GitHub mirror of the tarball from http://www.cs.cmu.edu/~chongw/slda/ with some modifications to get it to build on OS X. If you submit a PR I'll merge it, but your question above has a much better chance if directed to the original authors on the paper.

angeloskath commented 8 years ago

Hi,

Thanks for your answer anyway. I also sent an email to the original author who did not respond.

I do not know if you want to leave this issue open and I 'll try to provide some files that reproduce the problem in case anyone has the time to work on it. In any case you could also close the issue and I 'll open another one if/when I get the time to produce those files.