Search in sources :

Example 11 with TestDiscrete

use of edu.illinois.cs.cogcomp.lbjava.classify.TestDiscrete in project cogcomp-nlp by CogComp.

the class NETesterMultiDataset method printAllTestResultsAsOneDataset.

/**
 * assumes that the data has been annotated by both levels of taggers
 */
public static TestDiscrete[] printAllTestResultsAsOneDataset(Vector<Data> dataCollection, boolean verbose, ParametersForLbjCode params) {
    TestDiscrete resultsPhraseLevel1 = new TestDiscrete();
    resultsPhraseLevel1.addNull("O");
    TestDiscrete resultsTokenLevel1 = new TestDiscrete();
    resultsTokenLevel1.addNull("O");
    TestDiscrete resultsPhraseLevel2 = new TestDiscrete();
    resultsPhraseLevel2.addNull("O");
    TestDiscrete resultsTokenLevel2 = new TestDiscrete();
    resultsTokenLevel2.addNull("O");
    TestDiscrete resultsByBILOU = new TestDiscrete();
    TestDiscrete resultsSegmentation = new TestDiscrete();
    resultsByBILOU.addNull("O");
    resultsSegmentation.addNull("O");
    for (int dataSetId = 0; dataSetId < dataCollection.size(); dataSetId++) reportPredictions(dataCollection.elementAt(dataSetId), resultsTokenLevel1, resultsTokenLevel2, resultsPhraseLevel1, resultsPhraseLevel2, resultsByBILOU, resultsSegmentation);
    System.out.println("------------------------------------------------------------");
    System.out.println("******	Combined performance on all the datasets :");
    for (int i = 0; i < dataCollection.size(); i++) System.out.println("\t>>> Dataset path : \t" + dataCollection.elementAt(i).datasetPath);
    System.out.println("------------------------------------------------------------");
    if (verbose) {
        if (params.featuresToUse.containsKey("PredictionsLevel1")) {
            System.out.println("Phrase-level Acc Level2:");
            resultsPhraseLevel2.printPerformance(System.out);
            System.out.println("Token-level Acc Level2:");
            resultsTokenLevel2.printPerformance(System.out);
            System.out.println("Level2 BILOU Accuracy, letter-by-letter:");
            resultsByBILOU.printPerformance(System.out);
            System.out.println("Level2 BILOU PHRASE/BOUNDARY DETECTION Accuracy");
            resultsSegmentation.printPerformance(System.out);
        }
        System.out.println("Phrase-level Acc Level1:");
        resultsPhraseLevel1.printPerformance(System.out);
        System.out.println("Token-level Acc Level1:");
        resultsTokenLevel1.printPerformance(System.out);
    } else {
        System.out.println("\t Level 1: " + resultsPhraseLevel1.getOverallStats()[2]);
        if (params.featuresToUse.containsKey("PredictionsLevel1"))
            System.out.println("\t Level 2: " + resultsPhraseLevel2.getOverallStats()[2]);
    }
    System.out.println("------------------------------------------------------------");
    System.out.println("************************************************************");
    System.out.println("------------------------------------------------------------");
    return new TestDiscrete[] { resultsPhraseLevel1, resultsPhraseLevel2 };
}
Also used : TestDiscrete(edu.illinois.cs.cogcomp.lbjava.classify.TestDiscrete)

Aggregations

TestDiscrete (edu.illinois.cs.cogcomp.lbjava.classify.TestDiscrete)11 Parser (edu.illinois.cs.cogcomp.lbjava.parse.Parser)3 File (java.io.File)3 Vector (java.util.Vector)3 FeatureVector (edu.illinois.cs.cogcomp.lbjava.classify.FeatureVector)2 BatchTrainer (edu.illinois.cs.cogcomp.lbjava.learn.BatchTrainer)2 SparseAveragedPerceptron (edu.illinois.cs.cogcomp.lbjava.learn.SparseAveragedPerceptron)2 LinkedVector (edu.illinois.cs.cogcomp.lbjava.parse.LinkedVector)2 NETaggerLevel1 (edu.illinois.cs.cogcomp.ner.LbjFeatures.NETaggerLevel1)2 NETaggerLevel2 (edu.illinois.cs.cogcomp.ner.LbjFeatures.NETaggerLevel2)2 IOException (java.io.IOException)2 ResourceManager (edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager)1 POSBracketToToken (edu.illinois.cs.cogcomp.lbjava.nlp.seg.POSBracketToToken)1 PrepSRLDataReader (edu.illinois.cs.cogcomp.prepsrl.data.PrepSRLDataReader)1 ConstrainedPrepSRLClassifier (edu.illinois.cs.cogcomp.prepsrl.inference.ConstrainedPrepSRLClassifier)1 CoreAnnotations (edu.stanford.nlp.ling.CoreAnnotations)1 AnswerAnnotation (edu.stanford.nlp.ling.CoreAnnotations.AnswerAnnotation)1 GoldAnswerAnnotation (edu.stanford.nlp.ling.CoreAnnotations.GoldAnswerAnnotation)1 CoreLabel (edu.stanford.nlp.ling.CoreLabel)1 SeqClassifierFlags (edu.stanford.nlp.sequences.SeqClassifierFlags)1