HIPS / pgmult

Dependent multinomials made easy: stick-breaking with the Pólya-gamma augmentation
MIT License
59 stars 22 forks source link

Unable to run AP example. #9

Closed mskb01 closed 7 years ago

mskb01 commented 7 years ago

Hello, Thanks for sharing pgmult! After installing it on OSX Mavericks, I tried running an example from ctm.py (the AP one), and got an assertion error that points to gslrandom.pyx. Is this a bug? Below you can find the stack trace.

T, V = 100, 1000 alpha_beta, alpha_theta = 0.05, 1. train_frac, test_frac = 0.95, 0.5 data, words = load_ap_data(V) Downloading AP data... loaded 2250 documents with a size 1000 vocabulary with 112.371111111 words per document on average train_data, test_data = split_test_train(data, train_frac=train_frac, test_frac=test_frac) 0 test words were never seen in training data sb_results = fit_sbctm_gibbs(train_data, test_data, T, 1500, True, alpha_beta) Running fit_sbctm_gibbs... Traceback (most recent call last): File "", line 1, in File "ctm.py", line 277, in fit model = cls(train_data, T, *args) File "lda.py", line 254, in init super(StickbreakingCorrelatedLDA, self).init(data, T, alpha_beta) File "lda.py", line 105, in init self.resample_z() File "lda.py", line 162, in resample_z multinomial(self.pyrngs, self.data.data, topicprobs, self.z) File "gslrandom/gslrandom.pyx", line 114, in gslrandom.gslrandom.multinomial (gslrandom/gslrandom.cpp:3524) AssertionError

mattjj commented 7 years ago

To narrow things down, are you able to run the test files in slinderman/pypolyagamma, like this one?

YunheFeng commented 7 years ago

I run into the same bug. The test files in slinderman/pypolyagamma can run successfully.

slinderman commented 7 years ago

Thanks for raising this. I was not able to reproduce this on my end, but I am using the latest gslrandom. Can you please try installing it from the github repository? https://github.com/slinderman/gslrandom

I also just pushed changes to pgmult that should make it Python 3 compatible.

mskb01 commented 7 years ago

Thanks! Yes, first installing the latest gslrandom, and then pgmult, made the problem go away!

mattjj commented 7 years ago

Awesome!