UCDenver-ccp/craft-shared-tasks

Divide by zero error when there is no coreference prediction

Opened this issue · 1 comments

Hi,

First of all, thank you for the CRAFT corpus and your extensive work that makes it easier to use.

While using the evaluation tool (version 4.0.1_0.1.2 from docker), we came across an error: java.lang.ArithmeticException: Divide by zero.

The command we use is:
sudo docker run --rm -v /home/nursima/Desktop/491/real_output:/files-to-evaluate -v /home/nursima/Desktop/491/CRAFT/articles/txt/:/corpus-distribution -v /home/nursima/Desktop/491/output:/gold ucdenverccp/craft-eval:4.0.1_0.1.2 sh -c '(cd /home/craft/evaluation && boot eval-coreference -c /corpus-distribution -i /files-to-evaluate -g /gold -b /home/craft/evaluation -s /home/craft/evaluation/coreference/reference-coreference-scorers.git)'

In the files-to-evaluate (real_output) directory, we give a prediction file for one article, with no coreference prediction.
11319941.conll.zip

In the gold (output) directory, there is gold file for that article.
11319941.conll.zip

But we get this error:
...
clojure.core/map/fn core.clj: 2646
craft-eval.coref/compile-coref-results-for-document/fn coref.clj: 185
craft-eval.coref/prf coref.clj: 146
...
java.lang.ArithmeticException: Divide by zero
clojure.lang.ExceptionInfo: Divide by zero
line: 437

It seems that the prf function in coref.clj line 145 causing the problem. It doesn't check whether denominators are zero. (tp + fp is zero in our case)

We would appreciate any help. Thank you.

Hi, thanks for the bug report. I'll take a look at this and will get back to you.