This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to calculate the AUC value for a ranger RF model ?

Hi Biostars community,

How can I calculate the AUC value for a ranger model ? Ranger is a fast implementation of randomForest algorithm in R. I'm using the following code to build the ranger model for classification purposes, and get the prediction from the model:

#Build the model using ranger() function
ranger.model <- ranger(formula, data = data_train, importance = 'impurity', write.forest = TRUE, num.trees = 3000, mtry = sqrt(length(currentComb)), classification = TRUE)
#get the prediction for the ranger model
pred.data <- predict(ranger.model, dat = data_test,)
table(pred.data$predictions)

But I dont know how to calculate the AUC value

Any idea ?

auc value ranger randomforest classification

2 answers

Hi debitboro, By any chance, did you get this answer?

Hi debitboro, you can try the following code.

rocRFall=roc(as.factor(pre.label),pred.data)
aucRF=pROC::auc(rocRFall)
print(aucRF)

Log in to answer this question.