f1Score function
F1 Score is the harmonic mean of precision and recall.
Implementation
double f1Score(List<int> yTrue, List<int> yPred, {int positiveLabel = 1}) {
final p = precision(yTrue, yPred, positiveLabel: positiveLabel);
final r = recall(yTrue, yPred, positiveLabel: positiveLabel);
final denominator = p + r;
return denominator == 0 ? 0.0 : 2 * p * r / denominator;
}