use of edu.illinois.cs.cogcomp.core.experiments.ClassificationTester in project cogcomp-nlp by CogComp.
the class ConstituentSpanSplittingEvaluatorTest method setUp.
@Before
public void setUp() throws Exception {
splittingTester = new ClassificationTester();
TextAnnotation prediction1TA = DummyTextAnnotationGenerator.generateAnnotatedTextAnnotation(new String[] {}, false, 1);
TextAnnotation prediction2TA = DummyTextAnnotationGenerator.generateAnnotatedTextAnnotation(new String[] {}, false, 2);
prediction1 = (SpanLabelView) prediction1TA.getView(ViewNames.TOKENS);
prediction2 = (SpanLabelView) prediction2TA.getView(ViewNames.TOKENS);
}
use of edu.illinois.cs.cogcomp.core.experiments.ClassificationTester in project cogcomp-nlp by CogComp.
the class CorefEvaluatorTest method testScores.
@Test
public void testScores() throws Exception {
ClassificationTester mucTester = new ClassificationTester();
CorefMUCEvaluator mucEvaluator = new CorefMUCEvaluator();
mucEvaluator.evaluate(mucTester, gold, predicted);
assertEquals(mucTester.getMacroF1(), 0.94, 0.01);
assertEquals(mucTester.getMacroPrecision(), 0.9, 0.01);
assertEquals(mucTester.getMacroRecall(), 1.0, 0.01);
ClassificationTester bcubedTester = new ClassificationTester();
CorefBCubedEvaluator bcubedEvaluator = new CorefBCubedEvaluator();
bcubedEvaluator.evaluate(bcubedTester, gold, predicted);
assertEquals(bcubedTester.getMacroF1(), 0.73, 0.01);
assertEquals(bcubedTester.getMacroPrecision(), 0.58, 0.01);
assertEquals(bcubedTester.getMacroRecall(), 1.0, 0.01);
ClassificationTester accuracyTester = new ClassificationTester();
CorefAccuracyEvaluator accuracyEvaluator = new CorefAccuracyEvaluator();
accuracyEvaluator.evaluate(accuracyTester, gold, predicted);
assertEquals(accuracyTester.getMacroF1(), 0.68, 0.01);
assertEquals(accuracyTester.getMacroPrecision(), 0.51, 0.01);
assertEquals(accuracyTester.getMacroRecall(), 1.0, 0.01);
}
use of edu.illinois.cs.cogcomp.core.experiments.ClassificationTester in project cogcomp-nlp by CogComp.
the class PredicateArgumentEvaluatorTest method setUp.
@Before
public void setUp() throws Exception {
senseTester = new ClassificationTester();
argLabelTester = new ClassificationTester();
String[] viewsToAdd = { ViewNames.SRL_VERB };
TextAnnotation taGold = DummyTextAnnotationGenerator.generateAnnotatedTextAnnotation(viewsToAdd, false, 3);
TextAnnotation taPred = DummyTextAnnotationGenerator.generateAnnotatedTextAnnotation(viewsToAdd, false, 3);
gold = (PredicateArgumentView) taGold.getView(ViewNames.SRL_VERB);
predicted = (PredicateArgumentView) taPred.getView(ViewNames.SRL_VERB);
}
use of edu.illinois.cs.cogcomp.core.experiments.ClassificationTester in project cogcomp-nlp by CogComp.
the class ConstituentLabelingEvaluatorTest method setUp.
@Before
public void setUp() throws Exception {
splittingTester = new ClassificationTester();
String[] viewsToAdd = { ViewNames.POS };
TextAnnotation goldTA = DummyTextAnnotationGenerator.generateAnnotatedTextAnnotation(viewsToAdd, false, 3);
TextAnnotation predictionTA = DummyTextAnnotationGenerator.generateAnnotatedTextAnnotation(viewsToAdd, true, 3);
gold = (SpanLabelView) goldTA.getView(ViewNames.POS);
predicted = (SpanLabelView) predictionTA.getView(ViewNames.POS);
}
use of edu.illinois.cs.cogcomp.core.experiments.ClassificationTester in project cogcomp-nlp by CogComp.
the class VerbSenseClassifierMain method evaluate.
@CommandDescription(description = "Performs evaluation.", usage = "evaluate")
public static void evaluate() throws Exception {
SenseManager manager = getManager(false);
Dataset testSet = Dataset.PTBTest;
ILPSolverFactory solver = new ILPSolverFactory(ILPSolverFactory.SolverType.JLISCuttingPlaneGurobi);
ClassificationTester senseTester = new ClassificationTester();
long start = System.currentTimeMillis();
int count = 0;
manager.getModelInfo().loadWeightVector();
IResetableIterator<TextAnnotation> dataset = SentenceDBHandler.instance.getDataset(testSet);
while (dataset.hasNext()) {
TextAnnotation ta = dataset.next();
if (!ta.hasView(SenseManager.getGoldViewName()))
continue;
TokenLabelView gold = (TokenLabelView) ta.getView(SenseManager.getGoldViewName());
ILPInference inference = manager.getInference(solver, gold.getConstituents());
assert inference != null;
TokenLabelView prediction = inference.getOutputView();
evaluateSense(gold, prediction, senseTester);
count++;
if (count % 1000 == 0) {
long end = System.currentTimeMillis();
log.info(count + " sentences done. Took " + (end - start) + "ms, Micro-F1 so far = " + senseTester.getMicroF1());
}
}
long end = System.currentTimeMillis();
System.out.println(count + " sentences done. Took " + (end - start) + "ms");
System.out.println("\n\n* Sense");
System.out.println(senseTester.getPerformanceTable(false).toOrgTable());
}
Aggregations