Skip to content

Commit

Permalink
Fixed bound computation, multiplying the expectation over author assi…
Browse files Browse the repository at this point in the history
…gnments by the number of words in the document. (#1156)
  • Loading branch information
olavurmortensen authored and tmylk committed Feb 20, 2017
1 parent 2316475 commit 5a7b43e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gensim/models/atmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ def bound(self, chunk, chunk_doc_idx=None, subsample_ratio=1.0, author2doc=None,
# Computing the bound requires summing over expElogtheta[a, k] * expElogbeta[k, v], which
# is the same computation as in normalizing phi.
phinorm = self.compute_phinorm(ids, authors_d, expElogtheta[authors_d, :], expElogbeta[:, ids])
word_score += np.log(1.0 / len(authors_d)) + cts.dot(np.log(phinorm))
word_score += np.log(1.0 / len(authors_d)) * sum(cts) + cts.dot(np.log(phinorm))

# Compensate likelihood for when `chunk` above is only a sample of the whole corpus. This ensures
# that the likelihood is always rougly on the same scale.
Expand Down

0 comments on commit 5a7b43e

Please sign in to comment.