fastROC: Fast ROC

Description Usage Arguments Value Examples

View source: R/my_functions.r

Description

Calculates the points in a Reciever-Operator Curve from the results of a classifcation model.

Usage

1
fastROC(probs, class)

Arguments

probs

A numeric vector of probabilities or likelihoods for each data point.

class

A numeric vector where 1 is positive and 0 is negative.

Value

a list containing the ROC curve.

Examples

1
2
3
4
5
6
7
8
library(AppliedPredictiveModeling)
data(abalone)
library(glmnet)
class <- factor(as.numeric(abalone$Type == "M"))
data <- data.matrix(abalone[,-1])
fit <- cv.glmnet(data, class, family="binomial")
probs <- predict(fit, newx=data)[,1]
with(fastROC(probs, class), plot(fpr, tpr, type="l"))

traversc/trqwe documentation built on Dec. 4, 2020, 4:21 a.m.