1

I want to try the LDA -c code by Blie .et.al. as it is in this link.

I have compiled the code, and when I run ./lda in my terminal, the following result is displayed.

usage : lda est [initial alpha] [k] [settings] [data] [random/seeded/manual=filename/*] [directory]
        lda inf [settings] [model] [data] [name]

Which means that, it has been complied correctly.

However, in spite reading the README.txt file there, I am not being able to succesfully run the LDA code. Either it says Segmentation fault (core dumped) or killed.

What am I missing? How to use it on the example data they have given?

I have read the stack overflow answer to the question asked here, but it was not useful as I dont know the default values.

P.S: I am a beginer.

Community
  • 1
  • 1
kingmakerking
  • 2,017
  • 2
  • 28
  • 44

1 Answers1

2

Are you using ap.txt instead of ap.dat by any chance? lda-c doesn't take raw sentences or marked up data as input; it takes a sequence of bag of words information for each document. When ap.dat has a line like 186 0:1 6144:1 3586:2 ..., it means that the corresponding document has 186 distinct words, word 0 appears once, word 6144 appears once, word 3586 appears twice, and so on.

This command works for me (using Blei's original code):

./lda est 0.1 10 settings.txt ap.dat random modeldir

(Feel free to tweak the initial alpha (0.1) and number of topics (10) as you wish.)

Ray
  • 1,706
  • 22
  • 30
  • It didn't work for me `reading data from ap.dat Segmentation fault (core dumped)` says the output :( – kingmakerking Nov 18 '15 at 06:10
  • Can you post the exact command you're using, as well as the contents of settings.txt and the first ten lines of ap.dat? Also, try it with the unmodified version from http://www.cs.princeton.edu/~blei/lda-c/. It didn't *look* like the github version changed anything significant, but it's worth checking. And tell me what line it's crashing on (for blei's version if it crashes in that one, and for the github version if it doesn't). – Ray Nov 18 '15 at 23:07
  • Thanks @Ray it worked for me, kingmakerking make sure you are pointing to the right location of you ap.dat file, the example assumes you ave it in the same folder. Also if you opened ap.dat in a text editor it might have changed the formatting so try downloading ap.dat again, putting in the same directory as the lda file and running – soheildb Jul 31 '16 at 22:41