From 3631f92cce9ea5ee4bf467524dcc8c4340fcf703 Mon Sep 17 00:00:00 2001 From: Michael Frasco Date: Wed, 24 May 2017 20:33:22 -0500 Subject: [PATCH] casted n_pos in auc() in R/R/metrics.r to numeric to prevent integer overflow --- R/R/metrics.r | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/R/metrics.r b/R/R/metrics.r index 3d8ad57..9db428a 100644 --- a/R/R/metrics.r +++ b/R/R/metrics.r @@ -121,7 +121,7 @@ rae <- function (actual, predicted) auc <- function(actual, predicted) { r <- rank(predicted) - n_pos <- sum(actual==1) + n_pos <- as.numeric(sum(actual==1)) n_neg <- length(actual) - n_pos auc <- (sum(r[actual==1]) - n_pos*(n_pos+1)/2) / (n_pos*n_neg) auc