| 229 | } |
| 230 | |
| 231 | double getLLRest(const _ModelState& ld) const |
| 232 | { |
| 233 | double ll = 0; |
| 234 | const size_t V = this->realV; |
| 235 | // topic-word distribution |
| 236 | // it has the very-small-value problem |
| 237 | ll += (math::lgammaT(V*eta) - math::lgammaT(eta)*V) * K; |
| 238 | for (Tid k = 0; k < K; ++k) |
| 239 | { |
| 240 | ll -= math::lgammaT(ld.numByTopic[k] + V * eta); |
| 241 | for (Vid v = 0; v < V; ++v) |
| 242 | { |
| 243 | ll += math::lgammaT(ld.numByTopicWord(k, v) + eta); |
| 244 | } |
| 245 | } |
| 246 | return ll; |
| 247 | } |
| 248 | |
| 249 | double getLL() const |
| 250 | { |