calibrationCurve static method
- List<
ConfidenceEvent> events
Calibration curve: for each confidence level (1-5), what is the average actual performance? Returns a map: {1: 0.32, 2: 0.45, ...}.
Implementation
static Map<int, double> calibrationCurve(List<ConfidenceEvent> events) {
final buckets = <int, List<double>>{};
for (final e in events) {
buckets.putIfAbsent(e.predictedConfidence, () => []);
buckets[e.predictedConfidence]!.add(e.actualPerformance);
}
return buckets.map(
(k, v) => MapEntry(k, v.reduce((a, b) => a + b) / v.length),
);
}