evalclass / precrec

An R library for accurate and fast calculations of Precision-Recall and ROC curves
https://evalclass.github.io/precrec
GNU General Public License v3.0
45 stars 5 forks source link

Precision - Recall plot using 15 values #6

Open anwarMZ opened 6 years ago

anwarMZ commented 6 years ago

Hi,

I am trying to understand how to use this package based on the results that i have. Hopefully you can help a bit. I have two classifiers and calculated precision and recall at 15 different threshold for each of them.

Classifier 1 Threshold - Recall - Precision 1 - 0.xxx - 0.xxx 2 - 0.xxx - 0.xxx 3 - 0.xxx - 0.xxx ..... 15 - 0.xxx - 0.xxx

Classifier 2 Threshold - Recall - Precision 1 - 0.xxx - 0.xxx 2 - 0.xxx - 0.xxx 3 - 0.xxx - 0.xxx ..... 15 - 0.xxx - 0.xxx

But i am not sure how to plot sscurves for it. Do i have to calculate F1 scores and use them as scores? What are the positive and negative values as in data P10N10? Labels i assume would be the threshold values?

Would be really helpful if you can direct me towards the solution.

Cheers, Zohaib

takayasaito commented 6 years ago

It seems like that you have already calculated precision and recall values yourself. You can simply make a plot with R's regular plot and lines functions if you are interested in creating precision-recall curves.

plot(x = your_df1[, 2], y = your_df1[, 3], type = "l", xlim = c(0, 1), ylim = c(0,1))
lines(x = your_df2[, 2], y = your_df2[, 3], type = "l")

You need at least two types of data if you want to use precrec to calculate precision-recall curves - the scores that the classifiers of your interest has produced from your test data and the labels from the same test data - as you can see them in P10N10 as an example.