Skip to content

Commit

Permalink
Use MicroAverage to aggregate MMEs per ptoject
Browse files Browse the repository at this point in the history
  • Loading branch information
dfuchss committed Aug 20, 2024
1 parent 0ff067c commit 9b3f3aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ public static <T> EvaluationResults<T> calculateWeightedAverageResults(Immutable
return evaluationResults(macroAverage);
}

public static EvaluationResults<String> calculateMicroAverageResults(ImmutableList<EvaluationResults<String>> results) {
var averages = getAverages(results);
if (averages == null)
return null;

var microAverage = averages.stream().filter(it -> it.getType() == AggregationType.MICRO_AVERAGE).findFirst().orElseThrow();
return evaluationResults(microAverage);
}

private static <T> EvaluationResults<T> evaluationResults(AggregatedClassificationResult average) {
var weightedAverageAsSingle = new SingleClassificationResult<T>(Sets.mutable.empty(), Sets.mutable.empty(), Sets.mutable.empty(), null, average
.getPrecision(), average.getRecall(), average.getF1(), average.getAccuracy(), average.getSpecificity(), average.getPhiCoefficient(), average
Expand All @@ -61,4 +70,5 @@ private static <T> List<AggregatedClassificationResult> getAverages(ImmutableLis

return calculator.calculateAverages(classifications, null);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ protected void runMissingModelElementInconsistencyEval(GoldStandardProject goldS

OVERALL_MME_RESULTS.addAll(results);

EvaluationResults<String> weightedResults = ResultCalculatorUtil.calculateWeightedAverageResults(results.toImmutable());
EvaluationResults<String> weightedResults = ResultCalculatorUtil.calculateMicroAverageResults(results.toImmutable());

MME_RESULTS.put(goldStandardProject, Tuples.pair(weightedResults, expectedInconsistencyResults));
logResultsMissingModelInconsistency(goldStandardProject, weightedResults, expectedInconsistencyResults);
Expand Down

0 comments on commit 9b3f3aa

Please sign in to comment.