1

I've trained several machine learning models (GLM, SVM, random forest) in R to perform binary classification (predicting the presence of gallstones) and plotted ROC curves/computed AUC using the pROC library to assess their performance on a test dataset.

I want to compare the models (using ROC/AUC) to a set of simple clinical criteria which looks for the presence of several clinical and lab findings to predict the presence of gallstones. I have a binary variable containing the ground truth (originally 0s and 1s however I assigned levels to 0 and 1) in the test dataset as well as a binary variable containing the predictions generated by applying this set of criteria to the test data.

I tried calling roc() and passing to it the ground truth and predictions as follows:

test_roc <- roc(chole_testing$ercp_conf_choled, asge_data$meets_vstrong_crit)

However I run into this error:

Setting levels: control = chole_neg, case = chole_pos
Error in roc.default(chole_testing$ercp_conf_choled, 
    asge_data$meets_vstrong_crit) : Predictor must be numeric or 
    ordered.

Can someone point out what I am doing wrong?

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
loperamide
  • 11
  • 3
  • 1
    This question is related and relevant: https://stats.stackexchange.com/questions/37795/roc-curve-for-discrete-classifiers-like-svm-why-do-we-still-call-it-a-curve – Calimo Oct 16 '20 at 08:18

0 Answers0