Search in sources :

Example 1 with Table

use of edu.illinois.cs.cogcomp.core.utilities.Table in project cogcomp-nlp by CogComp.

the class EvaluationRecord method getSummaryTable.

public Table getSummaryTable() {
    Table table = new Table();
    table.addColumn("Precision");
    table.addColumn("Recall");
    table.addColumn("F1");
    table.addRow(new String[] { StringUtils.getFormattedString(getPrecision(), 3), StringUtils.getFormattedString(getRecall(), 3), StringUtils.getFormattedString(getF1(), 3) });
    return table;
}
Also used : Table(edu.illinois.cs.cogcomp.core.utilities.Table)

Example 2 with Table

use of edu.illinois.cs.cogcomp.core.utilities.Table in project cogcomp-nlp by CogComp.

the class ClassificationTester method getPerformanceTable.

private Table getPerformanceTable(boolean printCounts, Map<String, EvaluationRecord> labelWiseRecords, EvaluationRecord evalRecord, Map<String, ShufflingBasedStatisticalSignificance> significance) {
    Table table = new Table();
    table.addColumn("Label");
    if (printCounts) {
        table.addColumn("Total Gold");
        table.addColumn("Total Predicted");
        table.addColumn("Correct Prediction");
    } else {
        table.addColumn("Correct");
        table.addColumn("Excess");
        table.addColumn("Missed");
    }
    table.addColumn("Precision");
    table.addColumn("Recall");
    table.addColumn("F1");
    for (String label : Sorters.sortSet(labelWiseRecords.keySet())) {
        if (label.equals("<null>"))
            continue;
        EvaluationRecord record = labelWiseRecords.get(label);
        table.addRow(getRow(label, record, printCounts, significance));
    }
    table.addSeparator();
    table.addRow(getRow("All", evalRecord, printCounts, significance));
    table.addSeparator();
    return table;
}
Also used : Table(edu.illinois.cs.cogcomp.core.utilities.Table)

Example 3 with Table

use of edu.illinois.cs.cogcomp.core.utilities.Table in project cogcomp-nlp by CogComp.

the class TextStatistics method getResults.

public Table getResults() {
    Table table = new Table();
    table.addColumn("Item");
    table.addColumn("Count");
    for (String s : counter.getSortedItems()) table.addRow(new String[] { s, "" + (int) (counter.getCount(s)) });
    return table;
}
Also used : Table(edu.illinois.cs.cogcomp.core.utilities.Table)

Example 4 with Table

use of edu.illinois.cs.cogcomp.core.utilities.Table in project cogcomp-nlp by CogComp.

the class ClassificationTester method getConfusionTable.

public Pair<Table, List<String>> getConfusionTable() {
    Table table = new Table();
    Set<String> set = new HashSet<>();
    for (String item : counter.items()) {
        String[] split = item.split("\\.");
        set.add(split[0]);
        set.add(split[1]);
    }
    List<String> sortSet = new ArrayList<>(set);
    Collections.sort(sortSet);
    table.addColumn("Gold");
    for (int i = 0; i < sortSet.size(); i++) {
        table.addColumn(i + "");
    }
    int id = 0;
    for (String label : sortSet) {
        List<String> s = new ArrayList<>();
        s.add(id + "");
        id++;
        for (String pLabel : sortSet) {
            int count = (int) counter.getCount(label + "." + pLabel);
            s.add(Integer.toString(count));
        }
        table.addRow(s.toArray(new String[s.size()]));
    }
    return new Pair<>(table, sortSet);
}
Also used : Table(edu.illinois.cs.cogcomp.core.utilities.Table) Pair(edu.illinois.cs.cogcomp.core.datastructures.Pair)

Aggregations

Table (edu.illinois.cs.cogcomp.core.utilities.Table)4 Pair (edu.illinois.cs.cogcomp.core.datastructures.Pair)1