Search in sources :

Example 6 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) {
    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 (ParametersForLbjCode.currentParameters.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 (ParametersForLbjCode.currentParameters.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)

Example 7 with TestDiscrete

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

the class TestPOS method main.

/**
     * Implements the program described above.
     *
     * @param args The command line parameters.
     **/
public static void main(String[] args) {
    // Parse the command line
    // if (args.length != 1) {
    // logger.error("usage: java edu.illinois.cs.cogcomp.lbj.pos.TestPOS <text file>");
    // System.exit(1);
    // }
    // String testingFile = args[0];
    ResourceManager rm = new POSConfigurator().getDefaultConfig();
    String testingFile = rm.getString("testData");
    TestDiscrete.testDiscrete(new TestDiscrete(), new POSTagger(), new POSLabel(), new POSBracketToToken(testingFile), true, 0);
}
Also used : TestDiscrete(edu.illinois.cs.cogcomp.lbjava.classify.TestDiscrete) ResourceManager(edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager) POSBracketToToken(edu.illinois.cs.cogcomp.lbjava.nlp.seg.POSBracketToToken)

Aggregations

TestDiscrete (edu.illinois.cs.cogcomp.lbjava.classify.TestDiscrete)7 Parser (edu.illinois.cs.cogcomp.lbjava.parse.Parser)2 Vector (java.util.Vector)2 ResourceManager (edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager)1 FeatureVector (edu.illinois.cs.cogcomp.lbjava.classify.FeatureVector)1 BatchTrainer (edu.illinois.cs.cogcomp.lbjava.learn.BatchTrainer)1 SparseAveragedPerceptron (edu.illinois.cs.cogcomp.lbjava.learn.SparseAveragedPerceptron)1 POSBracketToToken (edu.illinois.cs.cogcomp.lbjava.nlp.seg.POSBracketToToken)1 LinkedVector (edu.illinois.cs.cogcomp.lbjava.parse.LinkedVector)1 NETaggerLevel1 (edu.illinois.cs.cogcomp.ner.LbjFeatures.NETaggerLevel1)1 NETaggerLevel2 (edu.illinois.cs.cogcomp.ner.LbjFeatures.NETaggerLevel2)1 PrepSRLDataReader (edu.illinois.cs.cogcomp.prepsrl.data.PrepSRLDataReader)1 ConstrainedPrepSRLClassifier (edu.illinois.cs.cogcomp.prepsrl.inference.ConstrainedPrepSRLClassifier)1 File (java.io.File)1 IOException (java.io.IOException)1