Togaware DATA MINING
Desktop Survival Guide
by Graham Williams
Google

Other Examples



# Based on code from demo(ROCR)
library(ROCR)
data(ROCR.hiv)
  pp <- ROCR.hiv$hiv.svm$predictions
  ll <- ROCR.hiv$hiv.svm$labels
  pred <- prediction(pp, ll)
  perf <- performance(pred, "tpr", "fpr")
pdf("graphics/rplot-rocr-4plots.pdf")
  par(mfrow = c(2, 2))
  plot(perf, avg = "threshold", colorize = T, lwd = 3,
       main = "Standard ROC curve.")

  plot(perf, lty = 3, col = "grey78", add = T)
  perf <- performance(pred, "prec", "rec")
  plot(perf, avg = "threshold", colorize = T, lwd = 3,
       main = "Precision/Recall graph.")

  plot(perf, lty = 3, col = "grey78", add = T)
  perf <- performance(pred, "sens", "spec")
  plot(perf, avg = "threshold", colorize = T, lwd = 3,
       main = "Sensitivity/Specificity plot.")

  plot(perf, lty = 3, col = "grey78", add = T)
  perf <- performance(pred, "lift", "rpp")
  plot(perf, avg = "threshold", colorize = T, lwd = 3,
    main = "Lift chart.")

  plot(perf, lty = 3, col = "grey78", add = T)
dev.off()

http://rattle.togaware.com/code/rplot-rocr-4plots.R



Subsections

Copyright © 2004-2006 Graham.Williams@togaware.com
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware.