def _recall_bias(df, frac):
    """Choose a bias for a decision function, such that
    at least `frac` fraction of positive examples satisfy

    clf.decision_function(X) >= bias

    Parameters
    ----------
    df: array-like
        Decision function evalued for positive examples
    frac : float
        Minimum fraction of positive examples to pass through

    Returns
    -------
    float
    """
    df.sort()

    tiny = 1e-7
    if frac <= 0:
        return df[-1] + tiny
    if frac >= 1:
        return df[0]

    ind = int((1 - frac) * df.size)
    return df[ind]