## Question

Error from AUC function on KNN algorithm

Professor Ballings,

My KNN algorithm seems to run fine but when i get to the last line of code and run " > auc(roc(predKNN,testKNN$Dependent))" i get the error

"Error in rank(prob) : argument "prob" is missing, with no default". Even when i download your lecture notes and run your exact code leading

up to the AUC function, I end up getting the same error. How can i fix this problem?

Thanks,

John

## Answers and follow-up questions

** Answer or follow-up question 1**Dear John,

You have probably loaded the glmnet package at some point (after you loaded AUC).

glmnet also includes a function called auc and will mask the auc function from the AUC package.

The solution is to use

AUC::auc(roc(predKNN,testKNN$Dependent))

instead of

auc(roc(predKNN,testKNN$Dependent))

Michel Ballings

Sign in to be able to add an answer or mark this question as resolved.