This repository has been archived by the owner on Dec 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 87
Topic modelling #188
Open
DonggeLiu
wants to merge
106
commits into
mediacloud:master
Choose a base branch
from
DonggeLiu:topic_modelling
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Topic modelling #188
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tokenize articles
…r yet) 2. A path helper to assit import 3. modified token_pool to make it compatible with LDA model
… into topic_modelling
1. Made every variable and method priavte if possible 2. Reformatted code with Pycharm shortcut 3. Added tests for TokenPool (works well) and ModelGensim (does work due to 'no module named XXX' problem when model_gensim is calling its abstract parent) 4. Decoupled token_pool and model_* 5. Used if __name__ == '__main__' to give a simple demonstration on how to use each mehtod Model_* 1. Renamed mode_lda.py and model_lda2.py to model_gensim.py (which uses the Gensim package) and model_lda.py (which uses the LDA package) 2. Added a abstract parent class TopicModel.py 3. Moved some code from summarise() to add_stories() (a. better structure of code; b. improved performance) 4. Changed some constants to function arguments (e.g. total_topic_num, iteration_num, etc.) TokenPool 1. Added mc_root_path() when locating the stopwords file 2. Modified query in token pool: 1. added "INNER JOIN stories WHERE language='en'" to guarantee all stories are in English 2. added "LIMIT" and corresponding "SELECT DISTINCT ... ORDER BY..." to guarantee only fetch the required number of stroies (thus improves performance) 3. added "OFFSET" 3. Restructured token_pool.py, so that the stories are traversed only once (thus improves performance) 4. Decoupled DB from token_pool.py 5. Replace regex tokenization with nltk.tokenizer 6. Added nltk.stem.WordNetLemmatizer to lemmatize (which gives a better result than stemming) tokens
The result of this algorithm is similar but slightly different from the LDA model + It allows multiple topics for each story
… into topic_modelling
2. renamed a few methods/variables due to the change of functionalities
…d based on a few points
…ihood comparisons
…ter efficiency and performance I will combine these two later
…en combined with tune_with_polynomial
… and cache dependencies
This allows more flexibility in Travis (i.e. use larger samples if we can run tests longer in Travis)
2. improve performance based on empirical results
added more comments
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.