require (datasets)
data (iris)
d = iris
levels (d [, 5]) = c ("+", "+", "-") # Building a two classes dataset
model.nb = NB (d [, -5], d [, 5])
model.lda = LDA (d [, -5], d [, 5])
# From the estimated probabilities: the meaningful curve
roc.curves (predict (model.nb, d [, -5], fuzzy = TRUE), d [, 5], positive = "+")
# Two models compared, one score column each
roc.curves (cbind (NB = predict (model.nb, d [, -5], fuzzy = TRUE) [, "+"],
LDA = predict (model.lda, d [, -5], fuzzy = TRUE) [, "+"]),
d [, 5], c ("NB", "LDA"), positive = "+")
# The same predictions reduced to hard labels: three points, and little to read
roc.curves (predict (model.nb, d [, -5]), d [, 5], positive = "+", type = "hard")
Run the code above in your browser using DataLab