interpret method
Interprets a 0.0–1.0 score (NLP metrics like BLEU/F1/GLEU).
Pass threshold is 0.5.
Implementation
EvaluationMetricInterpretation interpret() {
final v = value;
if (v == null || v < 0 || v > 1) {
return EvaluationMetricInterpretation(
rating: EvaluationRating.inconclusive);
}
final rating = v > 0.8
? EvaluationRating.exceptional
: v > 0.6
? EvaluationRating.good
: v > 0.4
? EvaluationRating.average
: v > 0.2
? EvaluationRating.poor
: EvaluationRating.unacceptable;
const threshold = 0.5;
if (v < threshold) {
return EvaluationMetricInterpretation(
rating: rating,
failed: true,
reason: '$name is less than $threshold.',
);
}
return EvaluationMetricInterpretation(rating: rating);
}