def f1_score()

in src/smclarify/bias/metrics/basic_stats.py [0:0]


def f1_score(TP: int, FP: int, FN: int) -> float:
    r"""
    Harmonic mean of precision and recall.

    :param: TP Counts of labels which were correctly predicted positive
    :param: FP Counts of labels which were incorrectly predicted positive
    :param: FN Counts of labels which were incorrectly predicted negative
    :return: Harmonic mean of precision and recall.
    """
    precision_score = precision(TP, FP)
    recall_score = recall(TP, FN)
    return 2 * divide(precision_score * recall_score, precision_score + recall_score)