Giter VIP home page Giter VIP logo

Comments (3)

kzhai avatar kzhai commented on September 18, 2024 2

Hi, Jorge,

The reason is the newer version of numpy enforces the data type to be explicitly defined, even creating from an all integer list.
Anyway, please try to run the code from a different repo https://github.com/kzhai/PyInfVoc. It basically contains the exact same code, but much cleaner.
I have just ported this repo to python3, so you should be able to run it without any problem.

kzhai@MININT-LPGA1J7:/mnt/c/Users/kezhai/Workspace/PyInfVoc$ python3 -m launch_train --input_directory=./de-news/ --output_directory=./ --truncation_level=4000 --number_of_pics=10 --number_of_documents=9800 --training_iterations=100 --vocab_prune_interval=10 --batch_size=98 --alpha_beta=100
========== ========== ========== ========== ==========
output_directory=./de-news/18Oct03-231005-D9800-K10-T4000-P10-I10-B98-O100-t64-k0.75-at0.1-ab100/
input_directory=./de-news
corpus_name=de-news
dictionary_file=None
number_of_documents=9800
number_of_topics=10
truncation_level=4000
vocab_prune_interval=10
snapshot_interval=10
batch_size=98
training_iterations=100
tau=64.0
kappa=0.75
alpha_theta=0.1
alpha_beta=100.0
========== ========== ========== ========== ==========
successfully load all training documents...
select documents from 0 to 98
P-step, E-step and M-step take 0, 2, 0 seconds respectively...
vocabulary size = [1725, 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1725]
training iteration 1 finished in 2.888820 seconds: epsilon = 0.043683
select documents from 98 to 196
P-step, E-step and M-step take 0, 2, 0 seconds respectively...
vocabulary size = [2582, 2582, 2582, 2582, 2582, 2582, 2582, 2582, 2582, 2582]
training iteration 2 finished in 3.002949 seconds: epsilon = 0.043186
select documents from 196 to 294
P-step, E-step and M-step take 0, 2, 0 seconds respectively...
vocabulary size = [3194, 3194, 3194, 3194, 3194, 3194, 3194, 3194, 3194, 3194]
training iteration 3 finished in 2.965397 seconds: epsilon = 0.042702
select documents from 294 to 392
P-step, E-step and M-step take 0, 4, 0 seconds respectively...
vocabulary size = [3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654]
training iteration 4 finished in 4.734318 seconds: epsilon = 0.042230
select documents from 392 to 490
P-step, E-step and M-step take 0, 3, 0 seconds respectively...

Thanks for digging into this, and feel free to let me know for any bugs.

Best,
Ke

from infvoclda.

kzhai avatar kzhai commented on September 18, 2024

from infvoclda.

jorgecastillo2 avatar jorgecastillo2 commented on September 18, 2024

Hi kzhai, thanks for answering
FInally i launch with python 2.7 and fixed the tab/space conversion via untabify spaces but I keep getting another error type:

Traceback (most recent call last):
  File "C:\Python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Users\Jorge Castillo\(...)l\InfVocLDA-master\src\infvoc\launch.py", line 248, in <module>
    main()
  File "C:\Users\Jorge Castillo\(...)\InfVocLDA-master\src\infvoc\launch.py", line 218, in main
    batch_gamma = olda.learning(docset);
  File "infvoc\hybrid.py", line 448, in learning
    sufficient_statistics, batch_document_topic_distribution = self.e_step(wordids);
  File "infvoc\hybrid.py", line 335, in e_step
    sufficient_statistics[k][0, id] += temp_phi[k, 0];
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

Clearly, I must edit the lines 335 and 448 of hybrid.py in order to recognize valid indexes

Edit: now I see, for both lines, that wordids is the problem but I don't know how to fix it.

Edit 2: Curiosly, between lines 309 to 317 there is no error, specifically in 310 it's defined wordid and in 317 the sentence temp_phi[k, 0] *= exp_weights[k][0, id]; don't give error, I don't know why.

Thanks for your help and code developing.

from infvoclda.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.