1.12.2015
- Numpy
- Scipy
- NLTK
Just put Gib.py in the same path as your project.
python Gib.py [corpus path] [iteration times] [number of topics]
from Gib import gibbssampler #Put the project in the same folder of your own work
gib = gibbssampler(path = "test.txt", K = 10, T =100)
gib.init_parameters() # randomize parameters
gib.iterate() # converging
print gib.produce("phi") # return a 2-D ndarray object for word-topic
print gib.produce("theta") # return a 2-D ndarray object for document-topic
<\code><\pre>