You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@opennlp.apache.org by Rodrigo Agerri <ra...@apache.org> on 2014/11/12 11:56:13 UTC

NER cross validation model not compatible exception

Hi,

I use the TokenNameFinderCrossEvaluation fine from CLI or API if I use
a NER dataset, e.g., CoNLL 03 for English.

However, whenever I tried with a dataset I created from another format, e.g.,

bin/opennlp TokenNameFinderCrossValidator -featuregen
lang/en/namefinder/en-namefinder.xml -params
lang/ml/PerceptronTrainerParams.txt -lang en -folds 5 -data
~/resources/semeval2015/semeval2014/semeval2014-train-v2/restaurants-train-semeval2014.txt

I get this

Indexing events using cutoff of 0

Computing event counts...  done. 0 events
Indexing...  done.
Collecting events... Done indexing.
Incorporating indexed data for training...
done.
Number of Event Tokens: 0
   Number of Outcomes: 0
 Number of Predicates: 0
Computing model parameters...
Performing 300 iterations.
  1:  . (0/0) NaN
  2:  . (0/0) NaN
  3:  . (0/0) NaN
  4:  . (0/0) NaN
  5:  . (0/0) NaN
  6:  . (0/0) NaN
  7:  . (0/0) NaN
  8:  . (0/0) NaN
  9:  . (0/0) NaN
 10:  . (0/0) NaN
 20:  . (0/0) NaN
 30:  . (0/0) NaN
 40:  . (0/0) NaN
 50:  . (0/0) NaN
 60:  . (0/0) NaN
 70:  . (0/0) NaN
 80:  . (0/0) NaN
 90:  . (0/0) NaN
[snip]

Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Model not compatible
with name finder!
at opennlp.tools.namefind.TokenNameFinderModel.<init>(TokenNameFinderModel.java:107)
at opennlp.tools.namefind.NameFinderME.train(NameFinderME.java:361)
at opennlp.tools.namefind.TokenNameFinderCrossValidator.evaluate(TokenNameFinderCrossValidator.java:222)
at opennlp.tools.cmdline.namefind.TokenNameFinderCrossValidatorTool.run(TokenNameFinderCrossValidatorTool.java:111)
at opennlp.tools.cmdline.CLI.main(CLI.java:224)
... 6 more
[ERROR]

The data looks like this (only one class)

Judging from previous posts this used to be a good <START:term> place
<END> , but not any longer .
We , there were four of us , arrived at noon - the place was empty -
and the <START:term> staff <END> acted like we were imposing on them
and they were very rude .
They never brought us complimentary noodles , ignored repeated
requests for sugar , and threw our dishes on the table .
The <START:term> food <END> was lousy - too sweet or too salty and the
<START:term> portions <END> tiny .
After all that , they complained to me about the small tip .
Avoid this <START:term> place <END> !

I know that this error usually means there some formatting error in
the opennlp format, but I have check and I cannot find any
(punctuation is allowed inside the NE span, right?). Furthermore, I
train fine with this same data, it is just the CrossValidation that
does not work.

Any other ideas?

R