We usually make an error when we calculate AUC of a training dataset in R. We set our training dataset in predict function the same way we define our validation data in the function. It is where we make a mistake.
This is incorrect
rfPred <- predict(tuned, dev, type ="prob")It is incorrect because we are telling R to consider our training dataset as a new dataset and predict it.
This is correct
rfPred <- predict(tuned, type ="prob")
library(ROCR)
#Storing Model Performance Scores
pred <-prediction(rfPred[,2], dev[, 1])
# Calculating Area under Curve
perf <- performance(pred,"auc")
auc <- as.numeric(perf@y.values)
auc
This comment has been removed by a blog administrator.
ReplyDelete