pROC 1.14.0

pROC 1.14.0 was released with many bug fixes and some new features.

Multiclass ROC

The multiclass.roc function can now take a multivariate input with columns corresponding to scores of the different classes. The columns must be named with the corresponding class labels. Thanks Matthias Döring for the contribution.

Let's see how to use it in practice with the iris dataset. Let's first split the dataset into a training and test sets:

data(iris)
iris.sample <- sample(1:150)
iris.train <- iris[iris.sample[1:75],]
iris.test <- iris[iris.sample[76:150],]

We'll use the nnet package to generate some predictions. We use the type="prob" to the predict function to get class probabilities.

library("nnet")
mn.net <- nnet::multinom(Species ~ ., iris.train)

iris.predictions <- predict(mn.net, newdata=iris.test, type="prob")
head(iris.predictions)
	          setosa   versicolor    virginica
	63  2.877502e-21 1.000000e+00 6.647660e-19
	134 1.726936e-27 9.999346e-01 6.543642e-05
	150 1.074627e-28 7.914019e-03 9.920860e-01
	120 6.687744e-34 9.986586e-01 1.341419e-03
	6   1.000000e+00 1.845491e-24 6.590050e-72
	129 4.094873e-45 1.779882e-15 1.000000e+00

Notice the column names, identical to the class labels. Now we can use the multiclass.roc function directly:

multiclass.roc(iris.test$Species, iris.predictions)

Many modelling functions have similar interfaces, where the output of predict can be changed with an extra argument. Check their documentation to find out how to get the required data.

Multiple aesthetics for ggroc

It is now possible to pass several aesthetics to ggroc. So for instance you can map a curve to both colour and linetype:

roc.list <- roc(outcome ~ s100b + ndka + wfns, data = aSAH)
ggroc(roc.list, aes=c("linetype", "color"))

ROC curves mapped to several aesthetics Mapping 3 ROC curves to 2 aesthetics with ggroc.

Getting the update

The update his available on CRAN now. You can update your installation by simply typing:

install.packages("pROC")

Here is the full changelog:

Xavier Robin
Published Wednesday, March 13, 2019 10:22 CET
Permalink: /blog/2019/03/13/proc-1.14.0
Tags: pROC
Comments: 0

Passer en français

Search

Tags

Background noise Books Computers Fun Hobbies Internet Me Mozilla My website Photo Politics Programming School Software Ubuntu pROC

Recent posts

Calendar

MonTueWedThuFriSatSun
123
45678910
11121314151617
18192021222324
25262728293031

Syndication

Recommend