(results, clf_index, target)
return ROCData(merged_curve, fold_curves, v_avg, t_avg)
Compute ROC Curve(s) from evaluation results.

    :param Orange.evaluation.Results results:
        Evaluation results.
    :param int clf_index:
        Learner index in the `results`.
    :param int target:
        Target class index (i.e. positive class).
    :rval ROCData:
        A instance holding the computed curves.
Compute ROC Curve(s) from evaluation results.
Compute ROC Curve ( s ) from evaluation results .
def roc_data_from_results(results, clf_index, target):
    """
    Compute ROC Curve(s) from evaluation results.

    :param Orange.evaluation.Results results:
        Evaluation results.
    :param int clf_index:
        Learner index in the `results`.
    :param int target:
        Target class index (i.e. positive class).
    :rval ROCData:
        A instance holding the computed curves.
    """
    merged = roc_curve_for_fold(results, ..., clf_index, target)
    merged_curve = ROCCurve(ROCPoints(*merged),
                            ROCPoints(*roc_curve_convex_hull(merged)))

    folds = results.folds if results.folds is not None else [...]
    fold_curves = []
    for fold in folds:
        points = roc_curve_for_fold(results, fold, clf_index, target)
        hull = roc_curve_convex_hull(points)
        c = ROCCurve(ROCPoints(*points), ROCPoints(*hull))
        fold_curves.append(c)

    curves = [fold.points for fold in fold_curves
              if fold.is_valid]

    if curves:
        fpr, tpr, std = roc_curve_vertical_average(curves)

        thresh = np.zeros_like(fpr) * np.nan
        hull = roc_curve_convex_hull((fpr, tpr, thresh))
        v_avg = ROCAveragedVert(
            ROCPoints(fpr, tpr, thresh),
            ROCPoints(*hull),
            std
        )
    else:
        # return an invalid vertical averaged ROC
        v_avg = ROCAveragedVert(
            ROCPoints(np.array([]), np.array([]), np.array([])),
            ROCPoints(np.array([]), np.array([]), np.array([])),
            np.array([])
        )

    if curves:
        all_thresh = np.hstack([t for _, _, t in curves])
        all_thresh = np.clip(all_thresh, 0.0 - 1e-10, 1.0 + 1e-10)
        all_thresh = np.unique(all_thresh)[::-1]
        thresh = all_thresh[::max(all_thresh.size // 10, 1)]

        (fpr, fpr_std), (tpr, tpr_std) = \
            roc_curve_threshold_average(curves, thresh)

        hull = roc_curve_convex_hull((fpr, tpr, thresh))

        t_avg = ROCAveragedThresh(
            ROCPoints(fpr, tpr, thresh),
            ROCPoints(*hull),
            tpr_std,
            fpr_std
        )
    else:
        # return an invalid threshold averaged ROC
        t_avg = ROCAveragedThresh(
            ROCPoints(np.array([]), np.array([]), np.array([])),
            ROCPoints(np.array([]), np.array([]), np.array([])),
            np.array([]),
            np.array([])
        )
    return ROCData(merged_curve, fold_curves, v_avg, t_avg)
def roc_data_from_results ( results , clf_index , target ) : merged = roc_curve_for_fold ( results , ... , clf_index , target ) merged_curve = ROCCurve ( ROCPoints ( * merged ) , ROCPoints ( * roc_curve_convex_hull ( merged ) ) ) folds = results . folds if results . folds is not None else [ ... ] fold_curves = [ ] for fold in folds : points = roc_curve_for_fold ( results , fold , clf_index , target ) hull = roc_curve_convex_hull ( points ) c = ROCCurve ( ROCPoints ( * points ) , ROCPoints ( * hull ) ) fold_curves . append ( c ) curves = [ fold . points for fold in fold_curves if fold . is_valid ] if curves : fpr , tpr , std = roc_curve_vertical_average ( curves ) thresh = np . zeros_like ( fpr ) * np . nan hull = roc_curve_convex_hull ( ( fpr , tpr , thresh ) ) v_avg = ROCAveragedVert ( ROCPoints ( fpr , tpr , thresh ) , ROCPoints ( * hull ) , std ) else : # return an invalid vertical averaged ROC v_avg = ROCAveragedVert ( ROCPoints ( np . array ( [ ] ) , np . array ( [ ] ) , np . array ( [ ] ) ) , ROCPoints ( np . array ( [ ] ) , np . array ( [ ] ) , np . array ( [ ] ) ) , np . array ( [ ] ) ) if curves : all_thresh = np . hstack ( [ t for _ , _ , t in curves ] ) all_thresh = np . clip ( all_thresh , 0.0 - 1e-10 , 1.0 + 1e-10 ) all_thresh = np . unique ( all_thresh ) [ : : - 1 ] thresh = all_thresh [ : : max ( all_thresh . size // 10 , 1 ) ] ( fpr , fpr_std ) , ( tpr , tpr_std ) = roc_curve_threshold_average ( curves , thresh ) hull = roc_curve_convex_hull ( ( fpr , tpr , thresh ) ) t_avg = ROCAveragedThresh ( ROCPoints ( fpr , tpr , thresh ) , ROCPoints ( * hull ) , tpr_std , fpr_std ) else : # return an invalid threshold averaged ROC t_avg = ROCAveragedThresh ( ROCPoints ( np . array ( [ ] ) , np . array ( [ ] ) , np . array ( [ ] ) ) , ROCPoints ( np . array ( [ ] ) , np . array ( [ ] ) , np . array ( [ ] ) ) , np . array ( [ ] ) , np . array ( [ ] ) ) return ROCData ( merged_curve , fold_curves , v_avg , t_avg )