def calc_ber(tpr, fpr):
    """calculate the balanced error rate

    Args:
        tpr (array or int): true positives
        fpr (array or int): false positives

    Returns:
        array or int: balanced error rate
    """
    return 0.5 * ((1- tpr)+fpr)