public void missclassified(T reference, T prediction) { samples++; Span[] references = asSpanArray(reference); Span[] predictions = asSpanArray(prediction); Set<Span> refSet = new HashSet<>(Arrays.asList(references)); Set<Span> predSet = new HashSet<>(Arrays.asList(predictions)); for (Span ref : refSet) { if (predSet.contains(ref)) { addTruePositive(ref.getType()); } else { addFalseNegative(ref.getType()); } } for (Span pred : predSet) { if (!refSet.contains(pred)) { addFalsePositive(pred.getType()); } } }
@Override public String toString() { return createReport(); }
private void addFalsePositive(String type) { Stats s = initStatsForOutcomeAndGet(type); s.incrementFalsePositive(); generalStats.incrementFalsePositive(); }
public void correctlyClassified(T reference, T prediction) { samples++; // add all true positives! Span[] spans = asSpanArray(reference); for (Span span : spans) { addTruePositive(span.getType()); } }
public String createReport(Locale locale) { StringBuilder ret = new StringBuilder(); int tp = generalStats.getTruePositives(); int found = generalStats.getFalsePositives() + tp; ret.append("Evaluated ").append(samples).append(" samples with ") .append(generalStats.getTarget()).append(" entities; found: ") .append(found).append(" entities; correct: ").append(tp).append(".\n"); ret.append(String.format(locale, FORMAT, "TOTAL", zeroOrPositive(generalStats.getPrecisionScore() * 100), zeroOrPositive(generalStats.getRecallScore() * 100), zeroOrPositive(generalStats.getFMeasure() * 100))); ret.append("\n"); SortedSet<String> set = new TreeSet<>(new F1Comparator()); set.addAll(statsForOutcome.keySet()); for (String type : set) { ret.append(String.format(locale, FORMAT_EXTRA, type, zeroOrPositive(statsForOutcome.get(type).getPrecisionScore() * 100), zeroOrPositive(statsForOutcome.get(type).getRecallScore() * 100), zeroOrPositive(statsForOutcome.get(type).getFMeasure() * 100), statsForOutcome.get(type).getTarget(), statsForOutcome.get(type) .getTruePositives(), statsForOutcome.get(type) .getFalsePositives())); ret.append("\n"); } return ret.toString(); }
public void correctlyClassified(T reference, T prediction) { samples++; // add all true positives! Span[] spans = asSpanArray(reference); for (Span span : spans) { addTruePositive(span.getType()); } }
public String createReport(Locale locale) { StringBuilder ret = new StringBuilder(); int tp = generalStats.getTruePositives(); int found = generalStats.getFalsePositives() + tp; ret.append("Evaluated ").append(samples).append(" samples with ") .append(generalStats.getTarget()).append(" entities; found: ") .append(found).append(" entities; correct: ").append(tp).append(".\n"); ret.append(String.format(locale, FORMAT, "TOTAL", zeroOrPositive(generalStats.getPrecisionScore() * 100), zeroOrPositive(generalStats.getRecallScore() * 100), zeroOrPositive(generalStats.getFMeasure() * 100))); ret.append("\n"); SortedSet<String> set = new TreeSet<>(new F1Comparator()); set.addAll(statsForOutcome.keySet()); for (String type : set) { ret.append(String.format(locale, FORMAT_EXTRA, type, zeroOrPositive(statsForOutcome.get(type).getPrecisionScore() * 100), zeroOrPositive(statsForOutcome.get(type).getRecallScore() * 100), zeroOrPositive(statsForOutcome.get(type).getFMeasure() * 100), statsForOutcome.get(type).getTarget(), statsForOutcome.get(type) .getTruePositives(), statsForOutcome.get(type) .getFalsePositives())); ret.append("\n"); } return ret.toString(); }
public void missclassified(T reference, T prediction) { samples++; Span[] references = asSpanArray(reference); Span[] predictions = asSpanArray(prediction); Set<Span> refSet = new HashSet<>(Arrays.asList(references)); Set<Span> predSet = new HashSet<>(Arrays.asList(predictions)); for (Span ref : refSet) { if (predSet.contains(ref)) { addTruePositive(ref.getType()); } else { addFalseNegative(ref.getType()); } } for (Span pred : predSet) { if (!refSet.contains(pred)) { addFalsePositive(pred.getType()); } } }
public void correctlyClassified(T reference, T prediction) { samples++; // add all true positives! Span[] spans = asSpanArray(reference); for (Span span : spans) { addTruePositive(span.getType()); } }
private void addFalseNegative(String type) { Stats s = initStatsForOutcomeAndGet(type); s.incrementTarget(); generalStats.incrementTarget(); }
public String createReport() { return createReport(Locale.getDefault()); }
public String createReport(Locale locale) { StringBuilder ret = new StringBuilder(); int tp = generalStats.getTruePositives(); int found = generalStats.getFalsePositives() + tp; ret.append("Evaluated ").append(samples).append(" samples with ") .append(generalStats.getTarget()).append(" entities; found: ") .append(found).append(" entities; correct: ").append(tp).append(".\n"); ret.append(String.format(locale, FORMAT, "TOTAL", zeroOrPositive(generalStats.getPrecisionScore() * 100), zeroOrPositive(generalStats.getRecallScore() * 100), zeroOrPositive(generalStats.getFMeasure() * 100))); ret.append("\n"); SortedSet<String> set = new TreeSet<>(new F1Comparator()); set.addAll(statsForOutcome.keySet()); for (String type : set) { ret.append(String.format(locale, FORMAT_EXTRA, type, zeroOrPositive(statsForOutcome.get(type).getPrecisionScore() * 100), zeroOrPositive(statsForOutcome.get(type).getRecallScore() * 100), zeroOrPositive(statsForOutcome.get(type).getFMeasure() * 100), statsForOutcome.get(type).getTarget(), statsForOutcome.get(type) .getTruePositives(), statsForOutcome.get(type) .getFalsePositives())); ret.append("\n"); } return ret.toString(); }
public void missclassified(T reference, T prediction) { samples++; Span[] references = asSpanArray(reference); Span[] predictions = asSpanArray(prediction); Set<Span> refSet = new HashSet<>(Arrays.asList(references)); Set<Span> predSet = new HashSet<>(Arrays.asList(predictions)); for (Span ref : refSet) { if (predSet.contains(ref)) { addTruePositive(ref.getType()); } else { addFalseNegative(ref.getType()); } } for (Span pred : predSet) { if (!refSet.contains(pred)) { addFalsePositive(pred.getType()); } } }
private void addTruePositive(String type) { Stats s = initStatsForOutcomeAndGet(type); s.incrementTruePositive(); s.incrementTarget(); generalStats.incrementTruePositive(); generalStats.incrementTarget(); }
@Override public String toString() { return createReport(); }
private void addFalsePositive(String type) { Stats s = initStatsForOutcomeAndGet(type); s.incrementFalsePositive(); generalStats.incrementFalsePositive(); }
@Override public String toString() { return createReport(); }
private void addFalsePositive(String type) { Stats s = initStatsForOutcomeAndGet(type); s.incrementFalsePositive(); generalStats.incrementFalsePositive(); }
public String createReport() { return createReport(Locale.getDefault()); }
private void addFalseNegative(String type) { Stats s = initStatsForOutcomeAndGet(type); s.incrementTarget(); generalStats.incrementTarget(); }