def _calc_f_beta_score(beta, precision, recall):
    """
    Calculates the F-score given the beta coefficient and the precision/recall scores.
    """

    beta_sq = beta * beta
    denominator = (beta_sq * precision) + recall

    f_beta = (1 + beta_sq) * precision * recall / denominator if denominator > 0.0 else 0.0
    return f_beta