I am trying to calculate accuracy using ROCR package in R but the result is different than what I expected:
Assume I have prediction of a model (p) and label (l) as following:
p <- c(0.61, 0.36, 0.43, 0.14, 0.38, 0.24, 0.97, 0.89, 0.78, 0.86)
l <- c(1, 1, 1, 0, 0, 1, 1, 1, 0, 1)
And I am calculating accuracy of this prediction using following commands:
library(ROCR)
pred <- prediction(p, l)
perf <- performance(pred, "acc")
max(perf@y.values[[1]])
but the result is .8 which according to accuracy formula (TP+TN)/(TN+TP+FN+FP) should be .6 I don't know why?