Togaware DATA MINING
Desktop Survival Guide
by Graham Williams
Google

Other Examples

Image rplot-rocr-4plots


# 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-2010 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
The PDF version is a formatted comprehensive draft book (with over 800 pages).
Brought to you by Togaware. This page generated: Sunday, 22 August 2010