Skip to content

Commit

Permalink
print
Browse files Browse the repository at this point in the history
  • Loading branch information
imdiptanu committed Mar 15, 2021
1 parent 0b0b9d8 commit 780a9c1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ This is a neural take on LDA-style topic modeling, i.e., based on a set of docum

The implementation is based on a lightweight neural architecture and aims to be a scalable alternative to LDA. It readily makes use of GPU computation and has been tested successfully on 1M documents with 200 topics (on a Titan Xp card with 12GB of memory).

Getting started: `python -m tests.basic.py data/my_docs.txt`
`export PYTHONPATH="${PYTHONPATH}:{path/to/dir}/Topic_Modeling/doc2topic"`

Getting started: `python -m tests/basic.py data/my_docs.txt 3 (# of topics)`

## Method

Expand Down
3 changes: 1 addition & 2 deletions doc2topic/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ def __init__(self, corpus, n_topics=20, batch_size=1024*6, n_epochs=5, lr=0.015,
#sim = dot([embD, embW], 0, normalize=True)
dot_prod = dot([embD, embW], 1, normalize=False)
dot_prod = Reshape((1,))(dot_prod)

print(embD, embW)
output = Activation('sigmoid')(dot_prod)

opt = Adam(lr=lr, amsgrad=True)

self.model = Model(inputs=[inlayerD,inlayerW], outputs=[output])
Expand Down
2 changes: 1 addition & 1 deletion tests/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
import sys

data = corpora.DocData(sys.argv[1])
model = models.Doc2Topic(data, n_topics=30)
model = models.Doc2Topic(data, n_topics=int(sys.argv[2]))

model.print_topic_words()

0 comments on commit 780a9c1

Please sign in to comment.