def iou_score(fn: float, fp: float, tp: float) -> float:
    """
    Calculate intersection over union.

    :param fn: False negative count.
    :param fp: False positive count.
    :param tp: True positive count.
    :return: IoU score.
    """
    return 0.0 if fp + tp + fn == 0 else tp / (fp + tp + fn)