8000 ci.cvAUC needs 0.5 for ties by ledell · Pull Request #11 · ledell/cvAUC · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ci.cvAUC needs 0.5 for ties #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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 <oss@ledell.org>
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
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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)
-----------------
Expand Down
12 changes: 6 additions & 6 deletions R/ci.cvAUC.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
1 change: 0 additions & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
@@ -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(' ')
}

Expand Down
0