[R] ROCR package finding maximum accuracy and optimal cutoff point
Saeed Abu Nimeh
sabunime at gmail.com
Fri Mar 27 02:32:20 CET 2009
If we use the ROCR package to find the accuracy of a classifier
pred <- prediction(svm.pred, testset[,2])
perf.acc <- performance(pred,"acc")
Do we find the maximum accuracy as follows (is there a simplier way?):
> max(perf.acc at x.values[[1]])
Then to find the cutoff point that maximizes the accuracy do we do the
following (is there a simpler way):
> cutoff.list <- unlist(perf.acc at x.values[[1]])
> cutoff.list[which.max(perf.acc at y.values[[1]])]
If the above is correct how is it possible to find the average false
positive and negative rates from the following
perf.fpr <- performance(pred, "fpr")
perf.fnr <- performance(pred, "fnr")
The dataset that consists of two columns; score and a binary response,
similar to this:
2.5, 0
-1, 0
2, 1
6.3, 1
4.1, 0
3.3, 1
Thanks,
Saeed
---
R 2.8.1 Win XP Pro SP2
ROCR package v1.0-2
e1071 v1.5-19
More information about the R-help
mailing list