auc_roc: Area Under the ROC Curve

Description Usage Arguments Details References Examples

View source: R/auc_roc.R

Description

Calculates Area Under the ROC Curve

Usage

1
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

1
2
3
4
5
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)

ben519/mltools documentation built on Sept. 22, 2021, 4:30 p.m.