kzhai / PyNPB

Non-parametric Bayesian in Python, including Indian buffet process (IBP), hierarchical Dirichlet process (HDP).
73 stars 32 forks source link

how to start , any guide,doc or example data to run? #1

Closed andyyuan78 closed 8 years ago

kzhai commented 9 years ago

Hi, Andy,

This code repo is very light. I believe you can run the code using command like "python hdp/ugs.py". Please let me know if you run into any problems. Thanks.

Best, Ke

andyyuan78 commented 9 years ago

lack of test data is a nightmare~~

ubgpu@ubgpu:~/github/PyNPB/src$ python hdp/ugs.py Traceback (most recent call last): File "hdp/ugs.py", line 497, in data = import_monolingual_data(temp_directory + "doc.dat"); File "hdp/ugs.py", line 417, in import_monolingual_data input = codecs.open(input_file, mode="r", encoding="utf-8") File "/usr/lib/python2.7/codecs.py", line 878, in open file = builtin.open(filename, mode, buffering) IOError: [Errno 2] No such file or directory: '../../data/test/doc.dat'

kzhai commented 9 years ago

Unfortunately, I don't have the testing data available at this point neither. You may try to use the same data from PyLDA repo and see if that works. From my memory, they should use the same data format.

Best, Ke

andyyuan78 commented 9 years ago

after change the fiile src/hdp/ugs.py as: if name == 'main': temp_directory = "/home/ubgpu/github/PyLDA/input/ap/"

temp_directory = "../../data/de-news/en/corpus-3/";

data = import_monolingual_data(temp_directory + "doc.dat");
print data

ubgpu@ubgpu:~/github/PyNPB$ sudo python src/hdp/ugs.py Traceback (most recent call last): File "src/hdp/ugs.py", line 497, in data = import_monolingual_data(temp_directory + "doc.dat"); File "src/hdp/ugs.py", line 426, in import_monolingual_data assert(len(contents) == 2); AssertionError ubgpu@ubgpu:~/github/PyNPB$

may the file format issue

kzhai commented 9 years ago

I see. That could be. Unfortunately, the data are in my other computer, I will commit them to the repo once I have a chance.

kzhai commented 9 years ago

Hi, Andy,

I have just committed some testing data to the repo. Please check if you run into any problem.

Best, Ke

andyyuan78 commented 9 years ago

this ubgpu@ubgpu:~/github/PyNPB/src$ python hdp/ugs.py is OK now.

but, the other

ubgpu@ubgpu:~/github/PyNPB$ python src/ibq/vb.py python: can't open file 'src/ibq/vb.py': [Errno 2] No such file or directory ubgpu@ubgpu:~/github/PyNPB$ python src/ibp/ugs.py Traceback (most recent call last): File "src/ibp/ugs.py", line 10, in from ibp.gs import GibbsSampling; ImportError: No module named ibp.gs

ubgpu@ubgpu:~/github/PyNPB$ python src/ibp/sgs.py Traceback (most recent call last): File "src/ibp/sgs.py", line 9, in from ibp.gs import GibbsSampling; ImportError: No module named ibp.gs ubgpu@ubgpu:~/github/PyNPB$

ubgpu@ubgpu:~/github/PyNPB$ python src/hdp/vb.py File "src/hdp/vb.py", line 15 lambda=None, ^ SyntaxError: invalid syntax

kzhai commented 9 years ago

Please refer to the README file for instructions, you need to specify -m option when using ibp. For hdp/vb.py, I will check it soon.