Search in sources :

Example 1 with EvaluationRecord

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();
}
Also used : SenseStructure(edu.illinois.cs.cogcomp.verbsense.jlis.SenseStructure) IInstance(edu.illinois.cs.cogcomp.sl.core.IInstance) EvaluationRecord(edu.illinois.cs.cogcomp.core.experiments.EvaluationRecord)

Aggregations

EvaluationRecord (edu.illinois.cs.cogcomp.core.experiments.EvaluationRecord)1 IInstance (edu.illinois.cs.cogcomp.sl.core.IInstance)1 SenseStructure (edu.illinois.cs.cogcomp.verbsense.jlis.SenseStructure)1