Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime error #55

Open
Glisho opened this issue Jun 11, 2019 · 1 comment
Open

Runtime error #55

Glisho opened this issue Jun 11, 2019 · 1 comment

Comments

@Glisho
Copy link

Glisho commented Jun 11, 2019

So, I iterated over a number of files in a folder and suddenly the program stopped and showed the following message. What is happening and what should I do?

Thank you in advance.

/home/gligur/.local/lib/python3.6/site-packages/wmd/__init__.py:668: RuntimeWarning: invalid value encountered in true_divide
  w /= w.sum()
wmd: weights are not normalized: 0 != 1000000000
[10:38:02] or-tools/src/graph/min_cost_flow.cc:1097: Max flow could not be computed.
wmd: status is 5
Traceback (most recent call last):
  File "/home/gligur/PycharmProjects/gligurtest/TopicClustering.py", line 26, in <module>
    array[i] = doc1.similarity(doc2)
  File "doc.pyx", line 370, in spacy.tokens.doc.Doc.similarity
  File "/home/gligur/.local/lib/python3.6/site-packages/wmd/__init__.py", line 652, in compute_similarity
    return libwmdrelax.emd(w1, w2, dists)
RuntimeError: negative cost was returned

Process finished with exit code 1
@obbrc
Copy link

obbrc commented Sep 12, 2019

When I had a similar problem with Spacy+WMD the reason was the empty document after Spacy removed the stop words. Spacy's stop word list contains the words that are not similar to other packages and quite extensive. That caused the document to became empty (well to be honest, the document contained a single line; "Re: will call :)". WMD-Relax should probably return NaN in those cases, my solution is try/expect around the distance calculation, and manually set the distance when an exception happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants