blei-lab / lda-c

This is a C implementation of variational EM for latent Dirichlet allocation (LDA), a topic model for text or other discrete data.
GNU Lesser General Public License v2.1
166 stars 93 forks source link

Mr.Blei, pls tell me how to use it. #4

Open 9crk opened 7 years ago

9crk commented 7 years ago

I'm a beginer of LDA. pls tell me how to use this lda command. usage : lda est [initial alpha] [k] [settings] [data] [random/seeded/*] [directory] lda inf [settings] [model] [data] [name]

in my mind. this is a tool to get the topic words of an article. so if I have handreds of articles by hand(like 0000.txt-1000.txt). how can I use lda to get the topic words of an article?

chanansh commented 7 years ago

the data format is explained in the readme.txt file. Each line should have a count of number of tokens followed by a term index and it counts. The term index should correspond to a vocabulary file.

See https://github.com/blei-lab/lda-c/blob/master/readme.txt for more details:

  1. Data format

Under LDA, the words of each document are assumed exchangeable. Thus, each document is succinctly represented as a sparse vector of word counts. The data is a file where each line is of the form:

 [M] [term_1]:[count] [term_2]:[count] ...  [term_N]:[count]

where [M] is the number of unique terms in the document, and the [count] associated with each term is how many times that term appeared in the document. Note that [term_1] is an integer which indexes the term; it is not a string.

kitescat commented 4 years ago

So how can i transform my data into this format,is there any script useful? pls tell me if anyone seeing this.