Obtaining the performance indicators of the classifier from the ROCR forecasting object
I am using ROCR to get performance measurements of various classification algorithms on my dataset. Although I can easily get the AUC figure relatively easily using the following code example:
predictions <- predict(rfmodel, test, type="prob")
pred.obj <- prediction(predictions[,2], data$response)
rfperf <- performance(pred.obj, "tpr","fpr")
print(sprintf("random forest AUC %f", as.numeric(performance(pred.obj,"auc")@y.values)))
I'm having trouble fetching other results like precision, recall, f, etc. as one value that I could include in the table in my article. I've tried the following:
> p <- performance(pred.obj,"prec", "rec")
> as.numeric(p@x.values)
Error: (list) object cannot be coerced to type 'double'
I can display the values, but that's not what I would like. Any ideas?
+3
source to share
2 answers