modify comment in LdaModel.inference() to be more explicit #3057
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One comment in LdaModel.inference() confused me:
# The optimal phi_{dwk} is proportional to expElogthetad_k * expElogbetad_w.
And I think it should modified to this so the comment would be more accurate:
# The optimal phi_{dwk} is proportional to expElogthetad_k * expElogbetad_kw.
Reasons:
1.
According to Algorithm 1 on paper:
Online Learning for Latent Dirichlet Allocation, NIPS 2010 http://www.cs.princeton.edu/~mdhoffma,
phi_dwk is proportional to exp(Elogtheta_dk + Elogbeta_kw).
2.
phi_{dwk}
is a scalar,expElogthetad_k
is a scalar, andexpElogbetad_w
is a vector with K elements, soexpElogthetad_k * expElogbetad_w
will return a vector with K elements, which does not match the type ofphi_{dwk}
. If we useexpElogthetad_k * expElogbetad_kw
instead, in whichexpElogbetad_kw
is a scalar, it matches.