@@ -0,0 +1,2017 @@
+package com.bbn.bue.common.evaluation;%0A%0Aimport com.bbn.bue.common.collections.IterableUtils.ZipPair;%0Aimport com.bbn.bue.common.symbols.Symbol;%0A%0Aimport com.google.common.collect.ImmutableList;%0A%0Aimport org.junit.Test;%0A%0Aimport static com.bbn.bue.common.collections.IterableUtils.zip;%0Aimport static junit.framework.TestCase.assertEquals;%0A%0Apublic class SummaryConfusionMatrixTest %7B%0A%0A  private static final Symbol LOC = Symbol.from(%22LOC%22);%0A  private static final Symbol ORG = Symbol.from(%22ORG%22);%0A  private static final Symbol PER = Symbol.from(%22PER%22);%0A%0A%0A  @Test%0A  public void testSummaryConfusionMatrix() %7B%0A    final ImmutableList%3CSymbol%3E goldAssignments = ImmutableList.of(%0A        PER, LOC, ORG, ORG, ORG, LOC, PER, PER);%0A    final ImmutableList%3CSymbol%3E systemAssignments = ImmutableList.of(%0A        PER, ORG, ORG, PER, ORG, LOC, PER, LOC);%0A%0A    final SummaryConfusionMatrices.Builder confusionMatrixB = SummaryConfusionMatrices.builder();%0A%0A    for (final ZipPair%3CSymbol, Symbol%3E goldSystemPair : zip(goldAssignments, systemAssignments)) %7B%0A      final Symbol goldSymbol = goldSystemPair.first();%0A      final Symbol systemSymbol = goldSystemPair.second();%0A%0A      confusionMatrixB.accumulatePredictedGold(systemSymbol, goldSymbol, 1.0);%0A    %7D%0A%0A    final SummaryConfusionMatrix confusionMatrix = confusionMatrixB.build();%0A%0A    // F-measure for PER: 2 true positives, 1 false positive, 1 false negative%0A    // precision = 2/3, recall = 2/3, F = 2/3%0A    assertEquals(2.0F / 3.0F,%0A        SummaryConfusionMatrices.FMeasureVsAllOthers(confusionMatrix, PER).F1());%0A%0A    // F-measure for ORG: 2 true positives, 1 false positive, 1 false negative%0A    // precision = 2/3, recall = 2/3, F = 2/3%0A    assertEquals(2.0F / 3.0F,%0A        SummaryConfusionMatrices.FMeasureVsAllOthers(confusionMatrix, ORG).F1());%0A%0A    // F-measure for LOC: 1 true positive, 1 false positive, 1 false negative%0A    // precision = 1/2, recall = 1/2, F=1/2%0A    assertEquals(0.5F, SummaryConfusionMatrices.FMeasureVsAllOthers(confusionMatrix, LOC).F1());%0A  %7D%0A%7D%0A

Add test and example for SummaryConfusionMatrix