CogComp / lbjava

Learning Based Java (LBJava)
http://cogcomp.cs.illinois.edu/page/software_view/LBJava
Other
13 stars 17 forks source link

ILP inference fails when classifier is loaded from model files #108

Open Slash0BZ opened 7 years ago

Slash0BZ commented 7 years ago

I have an ILP Inference classifier that relies on a base classifier. When the classifier is initialized and trained, the ILP inference classifier works fine.

However, if I initialize the base classifier with a model file and a lexicon file that are pre-trained, the ILP classifier gives me an error LBJava ERROR: Classifier relation_classifier did not return any scores. ILP inference cannot be performed.

The error message is produced from https://github.com/CogComp/lbjava/blob/434cf0a40e4f2ae08c96d3ae1b96f319eb531d67/lbjava/src/main/java/edu/illinois/cs/cogcomp/lbjava/infer/ILPInference.java#L173-#L174

Slash0BZ commented 7 years ago

I have found a solution.

Instead of using classifier a = new classifier(model, lexicon), Using

classifier a = new classifier();
a.readLexicon(lexicon);
a.readModel(model);

solves the issue.

I still think it's a design issue.

danyaljj commented 7 years ago

Yeah sounds like a bug. Were you able to where is the constructor you're calling? (why different behaviors emerge with different inputs?)

Slash0BZ commented 7 years ago

I briefly tried to find a difference and I believe the only difference is isClone is set to false in the second way (the working one), and set to true in the buggy one.