roc {e2tree} | R Documentation |
Roc curve
Description
Computes and plots the Receiver Operating Characteristic (ROC) curve for a binary classification model, along with the Area Under the Curve (AUC). The ROC curve is a graphical representation of a classifier’s performance across all classification thresholds.
Usage
roc(response, scores, target = "1")
Arguments
response |
is the response variable vector |
scores |
is the probability vector of the prediction |
target |
is the target response class |
Value
an object.
Examples
## Classification:
data(iris)
# Create training and validation set:
smp_size <- floor(0.75 * nrow(iris))
train_ind <- sample(seq_len(nrow(iris)), size = smp_size)
training <- iris[train_ind, ]
validation <- iris[-train_ind, ]
response_training <- training[,5]
response_validation <- validation[,5]
# Perform training:
ensemble <- randomForest::randomForest(Species ~ ., data=training,
importance=TRUE, proximity=TRUE)
D <- createDisMatrix(ensemble, data=training, label = "Species",
parallel = list(active=FALSE, no_cores = 1))
setting=list(impTotal=0.1, maxDec=0.01, n=2, level=5)
tree <- e2tree(Species ~ ., training, D, ensemble, setting)
pr <- ePredTree(tree, validation, target="setosa")
roc(response_training, scores = pr$score, target = "setosa")
[Package e2tree version 0.1.2 Index]