📅  最后修改于: 2022-03-11 15:00:21.608000             🧑  作者: Mango
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