Skip to content

Wrong calculation for max_iter_dump #1216

@ajkl

Description

@ajkl

In
https://github.com/RaRe-Technologies/gensim/blob/develop/gensim/models/wrappers/wordrank.py#L144
Shouldnt this line max_iter_dump = iter / dump_period * dump_period - 1 just be
max_iter_dump = iter - dump_period ?

To reproduce try these parameters:
model = Wordrank.train(wr_path, data, out_dir, iter=100, dump_period=5)
It will error out with -

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ajkale/anaconda2/envs/wordrank/lib/python2.7/site-packages/gensim/models/wrappers/wordrank.py", line 146, in train
    copyfile('model_word_%d.txt' % max_iter_dump, 'wordrank.words')
  File "/home/ajkale/anaconda2/envs/wordrank/lib/python2.7/shutil.py", line 82, in copyfile
    with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: 'model_word_99.txt'

Mainly because max_iter_dump = iter / dump_period * dump_period - 1 calculates max_iter_dump=99 instead of 95.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions