From bade50168e3909f0a47771d42e3b6785d8274df9 Mon Sep 17 00:00:00 2001 From: ledell Date: Mon, 26 Apr 2021 15:23:42 -0700 Subject: [PATCH 1/2] Fixing .IC function to use 0.5 for ties --- R/ci.cvAUC.R | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/R/ci.cvAUC.R b/R/ci.cvAUC.R index cf49b22..b28aa79 100644 --- a/R/ci.cvAUC.R +++ b/R/ci.cvAUC.R @@ -25,14 +25,14 @@ ci.cvAUC <- function(predictions, labels, label.ordering = NULL, folds = NULL, c n_rows <- length(fold_labels) n_pos <- sum(fold_labels == pos) n_neg <- n_rows - n_pos + pos_rows <- fold_labels == pos + neg_rows <- fold_labels == neg auc <- AUC(fold_preds, fold_labels) DT <- data.table(pred = fold_preds, label = fold_labels) - DT <- DT[order(pred, -xtfrm(label))] #Sort by asc(pred), desc(label) - DT[, fracNegLabelsWithSmallerPreds := cumsum(label == neg)/n_neg] - DT <- DT[order(-pred, label)] - DT[, fracPosLabelsWithLargerPreds := cumsum(label == pos)/n_pos] - DT[, icVal := ifelse(label == pos, w1 * (fracNegLabelsWithSmallerPreds - auc), - w0 * (fracPosLabelsWithLargerPreds - auc))] + DT[pos_rows, `:=`(icVal, apply(DT[pos_rows,], 1, function(x){ + sum(x["pred"] > DT[neg_rows, pred] + .5*(x["pred"] == DT[neg_rows,pred]))})/n_neg * w1 - auc*w1)] + DT[neg_rows, `:=`(icVal, apply(DT[neg_rows,], 1, function(x){ + sum(x["pred"] < DT[pos_rows, pred] + .5*(x["pred"] == DT[pos_rows,pred]))})/n_pos * w0 - auc*w0)] return(mean(DT$icVal^2)) } From d227502cccfc1141368a801b81d0f37308dd6439 Mon Sep 17 00:00:00 2001 From: ledell Date: Mon, 26 Apr 2021 17:53:31 -0700 Subject: [PATCH 2/2] Up version to 1.1.3 --- DESCRIPTION | 7 +++---- NEWS | 3 +++ R/zzz.R | 1 - 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index fc5276b..0a81491 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,14 +1,13 @@ Package: cvAUC Type: Package Title: Cross-Validated Area Under the ROC Curve Confidence Intervals -Version: 1.1.2 -Date: 2015-10-18 +Version: 1.1.3 +Date: 2021-04-26 Author: Erin LeDell, Maya Petersen, Mark van der Laan Maintainer: Erin LeDell Description: Tools for working with and evaluating cross-validated area under the ROC curve (AUC) estimators. The primary functions of the package are ci.cvAUC and ci.pooled.cvAUC, which report cross-validated AUC and compute confidence intervals for cross-validated AUC estimates based on influence curves for i.i.d. and pooled repeated measures data, respectively. One benefit to using influence curve based confidence intervals is that they require much less computation time than bootstrapping methods. The utility functions, AUC and cvAUC, are simple wrappers for functions from the ROCR package. License: Apache License (== 2.0) -Depends: ROCR -Imports: data.table +Imports: ROCR, data.table URL: https://github.com/ledell/cvAUC BugReports: https://github.com/ledell/cvAUC/issues LazyLoad: yes diff --git a/NEWS b/NEWS index 16c4bd7..a3ff8d2 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,9 @@ To Do ----------------- * Consider automatically converting `labels` or `predictions` to a vector if it's a 1-column data.frame. Otherwise, it will fail the check that `length(unique(labels)) == 2` and `length(predictions) == length(labels)`. +cvAUC 1.1.3 (2021-04-26) +----------------- +* `ci.cvAUC()` needs 0.5 for ties: https://github.com/ledell/cvAUC/issues/6 cvAUC 1.1.2 (10-18-2015) ----------------- diff --git a/R/zzz.R b/R/zzz.R index 3e32a69..5eb9a06 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,7 +1,6 @@ .onAttach <- function(...) { packageStartupMessage(' ') packageStartupMessage('cvAUC version: ', utils::packageDescription('cvAUC')$Version) - packageStartupMessage('Notice to cvAUC users: Major speed improvements in version 1.1.0') packageStartupMessage(' ') }