ROC.plot: ROC.plot

View source: R/threshold.R

ROC.plotR Documentation

ROC.plot

Description

Function that plots the ROC curve of a prediction with only 2 categories.

Usage

ROC.plot(prediction, real, .add = FALSE, color = "red")

Arguments

prediction

A vector of real numbers representing the prediction score of a category.

real

A vector with the real categories of the individuals in the prediction.

.add

A logical value that indicates if it should be added to an existing graph

color

Color of the ROC curve in the graph

Value

A plot object.

See Also

prediction and performance

Examples


iris2 <- dplyr::filter(iris,(Species == "setosa") | (Species == "virginica"))
iris2$Species <- factor(iris2$Species,levels = c("setosa","virginica"))
sam <- sample(1:100,20)
ttesting <- iris2[sam,]
ttraining <- iris2[-sam,]
model <- train.rpart(Species~.,ttraining)
prediction.prob <- predict(model,ttesting, type = "prob")
ROC.plot(prediction.prob$prediction[,2],ttesting$Species)


PROMiDAT/trainR documentation built on Nov. 13, 2023, 3:20 a.m.