ROC.area {traineR} | R Documentation |
ROC.area
Description
Function that calculates the area of the ROC curve of a prediction with only 2 categories.
Usage
ROC.area(prediction, real)
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. |
Value
The value of the area(numeric).
See Also
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.area(prediction.prob$prediction[,2],ttesting$Species)
[Package traineR version 2.2.0 Index]