def cutoff_youdens_j(fpr, tpr, thresholds):
    """
    Computes optimal threshold of roc curve via Youdens j-score

    :param fpr:         False Positive Rate
    :param tpr:         True Postitive Rate
    :param thresholds:  Thresholds from roc_curve

    :return optimal threshold

    """

    j_scores = tpr - fpr
    j_ordered = sorted(zip(j_scores, thresholds))
    return j_ordered[-1][1]