12 December 2013 2 2K Report

When I use multiclass.roc function in R (pROC package), for instance, I trained a data set by random forest, here is my code:

##############################################

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'))

##############################################

And the result is:

#######################################################

Call:

multiclass.roc.default(response = iris$Species, predictor = predict(rf,

iris, type = "prob"))

Data: predict(rf, iris, type = "prob") with 3 levels of iris$Species: setosa,

versicolor, virginica.

Multi-class area under the curve: 0.5142

#######################################################

Is this right? Thanks!!!

"pROC" reference: http://www.inside-r.org/packages/cran/pROC/docs/multiclass.roc

Similar questions and discussions