MCPcopy Create free account
hub / github.com/bab2min/tomotopy / getLLDocs

Method getLLDocs

src/TopicModel/CTModel.hpp:197–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 3

lgammaTFunction · 0.85
getLLMethod · 0.45
getSumWordWeightMethod · 0.45

Tested by

no test coverage detected