ModelMetrics v1.2.2.2


Monthly downloads



Rapid Calculation of Model Metrics

Collection of metrics for evaluating models written in C++ using 'Rcpp'. Popular metrics include area under the curve, log loss, root mean square error, etc.


ModelMetrics: Rapid Calculation of Model Metrics

Build Status Build status Coverage Status Downloads

Tyler Hunt


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:


Or you can install the development version from Github with devtools:


Benchmark and comparison

N = 100000
Actual = as.numeric(runif(N) > .5)
Predicted = as.numeric(runif(N))

actual = Actual
predicted = Predicted

s1 <- system.time(a1 <- ModelMetrics::auc(Actual, Predicted))
s2 <- system.time(a2 <- Metrics::auc(Actual, Predicted))
# Warning message:
# In n_pos * n_neg : NAs produced by integer overflow
s3 <- system.time(a3 <- pROC::auc(Actual, Predicted))
s4 <- system.time(a4 <- MLmetrics::AUC(Predicted, Actual))
# Warning message:
# In n_pos * n_neg : NAs produced by integer overflow
s5 <- system.time({pp <- ROCR::prediction(Predicted, Actual); a5 <- ROCR::performance(pp, 'auc')})

  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

Functions in ModelMetrics

Name Description
confusionMatrix Confusion Matrix
mae Mean absolute error
mauc Multiclass Area Under the Curve
logLoss Log Loss
mcc Matthews Correlation Coefficient
f1Score F1 Score
fScore F Score
mlogLoss Multiclass Log Loss
mse Mean Square Error
testDF Test data
ppv Positive Predictive Value
kappa kappa statistic
gini GINI Coefficient
rmse Root-Mean Square Error
recall Recall, Sensitivity, tpr
auc Area Under the Curve
tnr Specificity, True negative rate
brier Brier Score
msle Mean Squared Log Error
rmsle Root Mean Squared Log Error
npv Negative Predictive Value
ce Classification error
No Results!

Last month downloads


Date 2018-11-03
License GPL (>= 2)
Encoding UTF-8
LazyData true
LinkingTo Rcpp
RoxygenNote 6.0.1
NeedsCompilation yes
Packaged 2020-03-17 06:58:01 UTC; ripley
Repository CRAN
Date/Publication 2020-03-17 07:45:31 UTC
imports data.table , Rcpp
depends R (>= 3.2.2)
suggests testthat

Include our badge in your README