auc_roc {mltools}R Documentation

Area Under the ROC Curve

Description

Calculates Area Under the ROC Curve

Usage

auc_roc(preds, actuals, returnDT = FALSE)

Arguments

preds

A vector of prediction values

actuals

A vector of actuals values (numeric or ordered factor)

returnDT

If TRUE, a data.table of (FalsePositiveRate, TruePositiveRate) pairs is returned, otherwise AUC ROC score is returned

Details

If returnDT=FALSE, returns Area Under the ROC Curve.If returnDT=TRUE, returns a data.table object with False Positive Rate and True Positive Rate for plotting the ROC curve.

References

https://en.wikipedia.org/wiki/Receiver_operating_characteristic#Area_under_the_curve

Examples

library(data.table)
preds <- c(.1, .3, .3, .9)
actuals <- c(0, 0, 1, 1)
auc_roc(preds, actuals)
auc_roc(preds, actuals, returnDT=TRUE)

[Package mltools version 0.3.5 Index]