September 2017
Beginner to intermediate
560 pages
25h 18m
English
Unlike in the preceding example, we might have arbitrary class labels for success and failure. The rocr-example-2.csv file has buyer and non-buyer as the class labels, with buyer representing the success case.
In this case, we need to explicitly indicate the failure and success labels by passing in a vector with the failure case as the first element:
> dat <- read.csv("roc-example-2.csv")
> pred <- prediction(dat$prob, dat$class, label.ordering = c("non-buyer", "buyer"))
> perf <- performance(pred, "tpr", "fpr")
> plot(perf)
> lines( par()$usr[1:2], par()$usr[3:4] )
Read now
Unlock full access