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

Use efficient normalization in LDA #894

Closed
olavurmortensen opened this issue Sep 27, 2016 · 4 comments
Closed

Use efficient normalization in LDA #894

olavurmortensen opened this issue Sep 27, 2016 · 4 comments
Labels
difficulty easy Easy issue: required small fix wishlist Feature request

Comments

@olavurmortensen
Copy link
Contributor

The Hierarchical Dirichlet Process model in Gensim uses a clever trick to efficiently normalize some variational parameters. It does this using a function called log_normalize, see line 49 and line 342 in the HDP code.

This could also be used in ldamodel.py, to make the normaization faster.

@tmylk tmylk added wishlist Feature request difficulty easy Easy issue: required small fix labels Sep 27, 2016
@ArifAhmed1995
Copy link
Contributor

I am working on this.

@olavurmortensen
Copy link
Contributor Author

On a related note, it would be nice if the log_normalize function was able to take a 2D array, and normalize along a single axis. At the moment it does support normalizing along both axes in a 2D array.

@olavurmortensen
Copy link
Contributor Author

I just discovered something you might find useful. From the usage of log_normalize in the HDP code, it seemed to me that if you want to normalize a vector v, you pass it to the function and obtain a normalized log v in return. That is not the case, you need to pass log v to the function, and then return a normalized log v.

This has caused me a lot of pain and confusion lately, so I though I'd warn you :)

@ArifAhmed1995
Copy link
Contributor

The time taken for the ldamodel tests to run worsens for the small file testcorpus.mm.Maybe log normalization will perform better for a larger corpus.I will test it out and post results soon.

@ghost ghost mentioned this issue Jun 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty easy Easy issue: required small fix wishlist Feature request
Projects
None yet
Development

No branches or pull requests

3 participants