from typing import Tuple


def _precision_recall_f1_from_tp_tpfp_tpfn(
    tp: int, tpfp: int, tpfn: int
) -> Tuple[float, float, float]:
    """
    Computing precision, recall and f1 score
    Args:
        tp: number of true positives
        tpfp: number of true positives + false positives
        tpfn: number of true positives + false negatives

    Returns:
        Precision, Recall and F1 score
    """
    precision, recall, f1_score = 0.0, 0.0, 0.0
    if tpfp:
        precision = tp / tpfp
    if tpfn:
        recall = tp / tpfn
    if precision and recall:
        f1_score = 2 * precision * recall / (precision + recall)
    return precision, recall, f1_score