use of edu.illinois.cs.cogcomp.core.experiments.EvaluationRecord in project cogcomp-nlp by CogComp.
the class JLISLearner method evaluateSenseStructure.
public static double evaluateSenseStructure(AbstractInferenceSolver inference, StructuredProblem testSet, WeightVector weights) throws Exception {
EvaluationRecord evalRecord = new EvaluationRecord();
for (int i = 0; i < testSet.input_list.size(); i++) {
IInstance x = testSet.input_list.get(i);
SenseStructure gold = (SenseStructure) testSet.output_list.get(i);
SenseStructure bestStructure = (SenseStructure) inference.getBestStructure(weights, x);
if (gold.getLabel() == bestStructure.getLabel())
evalRecord.incrementCorrect();
evalRecord.incrementGold();
evalRecord.incrementPredicted();
}
log.info("Predicted = " + evalRecord.getPredictedCount() + ", Gold = " + evalRecord.getGoldCount() + " Correct = " + evalRecord.getCorrectCount());
return evalRecord.getF1();
}
Aggregations