R Data Science: R Programming A-Z: R For Data Science With Real Exercises!
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")
#Storing Model Performance Scores
pred <-prediction(rfPred[,2], dev[, 1])
# Calculating Area under Curve
perf <- performance(pred,"auc")
auc <- as.numeric(email@example.com)