roc for random forest code example

Example: random forest roc curve r

data(iris)
library(randomForest)
library(pROC)
set.seed(1000)
# 3-class in response variable
rf = randomForest(Species~., data = iris, ntree = 100)
# predict(.., type = 'prob') returns a probability matrix
multiclass.roc(iris$Species, predict(rf, iris, type = 'prob'))

##shout out to Yin Zhao for the clear explanation
##https://www.researchgate.net/post/How_to_deal_with_multiple_class_ROC_analysis_in_R_pROC_package

Tags:

Misc Example