Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hdplda.py:sampling_k #11

Open
ttjs219 opened this issue Jun 22, 2016 · 1 comment
Open

hdplda.py:sampling_k #11

ttjs219 opened this issue Jun 22, 2016 · 1 comment

Comments

@ttjs219
Copy link

ttjs219 commented Jun 22, 2016

Hello,master:
Thanks for you code which give me more thought. I'am a new scholar in learning hdp-model.when i understand the code in your iir/lda/hdplda.py ,the row of 252 and 253 makes me puzzle.when we sample k,what is the mean of 'log_p_k[i]' and 'log_p_k[K]'.
Otherwise,the code 'k_new = self.sampling_topic(numpy.exp(log_p_k - log_p_k.max()))',should i change 'log_p_k.max()' to 'log_p_k.sum()'.can you tell me the program process or formula about that.thanks!

@shuyo
Copy link
Owner

shuyo commented Jun 22, 2016

Subtracting the maximum is to suppress overflow/underflow.
It gives the same result if the maximum is replaced with any value as long as no overflow/underflow.
Check an implementation of softmax function if you want to know more detail.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants