Tyler Hunt thunt@snapfinance.com
ModelMetrics is a much faster and reliable package for evaluating models. ModelMetrics is written in using Rcpp making it faster than the other packages used for model metrics.
You can install this package from CRAN:
install.packages("ModelMetrics")
Or you can install the development version from Github with devtools:
::install_github("JackStat/ModelMetrics") devtools
= 100000
N = as.numeric(runif(N) > .5)
Actual = as.numeric(runif(N))
Predicted
= Actual
actual = Predicted
predicted
<- system.time(a1 <- ModelMetrics::auc(Actual, Predicted))
s1 <- system.time(a2 <- Metrics::auc(Actual, Predicted))
s2 # Warning message:
# In n_pos * n_neg : NAs produced by integer overflow
<- system.time(a3 <- pROC::auc(Actual, Predicted))
s3 <- system.time(a4 <- MLmetrics::AUC(Predicted, Actual))
s4 # Warning message:
# In n_pos * n_neg : NAs produced by integer overflow
<- system.time({pp <- ROCR::prediction(Predicted, Actual); a5 <- ROCR::performance(pp, 'auc')})
s5
data.frame(
package = c("ModelMetrics", "pROC", "ROCR")
Time = c(s1[[3]],s3[[3]],s5[[3]])
,
)
# MLmetrics and Metrics could not calculate so they are dropped from time comparison
# package Time
# 1 ModelMetrics 0.030
# 2 pROC 50.359
# 3 ROCR 0.358