zhezhaoa/ngram2vec

Divide by zero error with 'seen' variable

mpickard-niu opened this issue · 1 comments

I'm getting this divide by zero error during the evaluation of every embedding when doing ngram_ngram.

Counts2glove finished
seen/total: 1/203
testsets/similarity/ws353_similarity.txt: nan
Traceback (most recent call last):
  File "/home/mpickard/Projects/ngram2vec/ngram2vec/ngram2vec/analogy_eval.py", line 102, in <module>
    main()
  File "/home/mpickard/Projects/ngram2vec/ngram2vec/ngram2vec/analogy_eval.py", line 75, in main
    accuracy_add = float(correct_add) / seen
ZeroDivisionError: float division by zero

I'm using Python 3. Any ideas on why seen is zero in the analogy.eval.py code? And why sim_actual and sim_expected end up with a correlation of zero in the similarity_eval.py code? I was trying the code on a small corpus.

I think my problem was my corpus was too small. A larger corpus works.