Exemple #1
0
def nonLinearInterpAupr(y_score, y_true):
    if y_score.ndim > 1:
        sub_stats = pd.DataFrame(np.concatenate((y_score, y_true), axis=1),
                                 dtype='float64')
    else:
        sub_stats = pd.DataFrame(np.array([y_score, y_true]).T)
    results = getAUROC_PR(sub_stats)
    return results, y_score, y_true
def nonLinearInterpAupr(y_score, y_true):
    """ Given ground truth targets and predicted targets, calculates
    weighted non-linear interpolated AUPRC.

    Parameters
    ----------
    y_true (list-like) - actual target values
    y_score (list-like) - predicted target values
    average (str, default 'micro') - one of 'micro', 'macro', 'samples', 'weighted'
        (see http://scikit-learn.org/stable/modules/generated/sklearn.metrics.roc_auc_score.html)
    sample_weight (list-like, optional) - of shape (n_samples,)

    Returns
    -------
    results (list), y_score (np.ndarray), y_true (np.ndarray)
    """
    if y_score.ndim > 1:
        sub_stats = pd.DataFrame(np.concatenate((y_score, y_true), axis=1),
                                 dtype='float64')
    else:
        sub_stats = pd.DataFrame(np.array([y_score, y_true]).T)
    results = getAUROC_PR(sub_stats)
    return results, y_score, y_true