| 195 | |
| 196 | template<typename _DocIter> |
| 197 | double getLLDocs(_DocIter _first, _DocIter _last) const |
| 198 | { |
| 199 | const auto K = this->K; |
| 200 | |
| 201 | double ll = 0; |
| 202 | for (; _first != _last; ++_first) |
| 203 | { |
| 204 | auto& doc = *_first; |
| 205 | Vector pbeta = doc.smBeta.array().log(); |
| 206 | Float last = pbeta[K - 1]; |
| 207 | for (Tid k = 0; k < K; ++k) |
| 208 | { |
| 209 | ll += pbeta[k] * (doc.numByTopic[k] + this->alphas[k]) - math::lgammaT(doc.numByTopic[k] + this->alphas[k] + 1); |
| 210 | } |
| 211 | pbeta.array() -= last; |
| 212 | ll += topicPrior.getLL(pbeta.head(this->K)); |
| 213 | ll += math::lgammaT(doc.getSumWordWeight() + this->alphas.sum() + 1); |
| 214 | } |
| 215 | return ll; |
| 216 | } |
| 217 | |
| 218 | void prepareDoc(_DocType& doc, size_t docId, size_t wordSize) const |
| 219 | { |
nothing calls this directly
no test coverage detected