While helping Benjamin write our recent ISWC paper we were drawn between plotting recall, precision or the f1-measure (a non-linear combination of the two). In theory f1-measure is the best since it leaves you with less numbers to display, but we focussed especially on recall, so we wanted this. In the end we plotting each approach we compared against both recall and precision in a 2d plot. We briefly thought about showing f-measure in the same chart, but the deadline came and there was no time left.

No the deadline is gone, but I made it work in R:

The fun thing about this is that both me and Ben tried to “solve” the f-measure equation for either R or P, i.e from:

get to:

And it took me at least three attempts to get it right. I am glad I’ve not forgotten any of my school math… ahem.

Get the R code at: http://www.dfki.uni-kl.de/~grimnes/2009/06/fmeasure/fmeasurePlot.R

I’m creator of WP-QuickLaTeX plugin you are using to publish math. I’ve just noticed that it generates some warnings on your page. I made changes to improve this situation. Please try the latest version of the plugin.

Thank you for using WP-QuickLaTeX!

Posted by Pavel Holoborodko on July 11th, 2009.

(almost) the same with Gnuplot:

# plot the iso-lines of the f1-measure as background grid

# and show the f1-measure’s values on the y2 axis

# f = 2pr/(p+r); r = fp/(2p-f); p = fr/(2r-f)

prec(f,r)=f*r/(2*r – f)

set style line 10 linetype 0 pointtype 0 linecolor rgb “gray”

set y2label ‘f1-measure’ tc rgb “gray”

set y2tics (“0.1” 0.053, “0.2” 0.111, “0.3” 0.177, “0.4” 0.250, “0.5” 0.333, “0.6” 0.429, “0.7” 0.539, “0.8” 0.666, “0.9” 0.818, “1” 1) textcolor rgb “gray”

plot ‘recommender.dat’ using 2:3 title ‘reco1’ with linespoints,\

‘recommender.dat’ using 4:5 title ‘reco2’ with linespoints,\

prec(1.0,x) title ” with lines ls 10,\

prec(0.9,x) title ” with lines ls 10,\

prec(0.8,x) title ” with lines ls 10,\

prec(0.7,x) title ” with lines ls 10,\

prec(0.6,x) title ” with lines ls 10,\

prec(0.5,x) title ” with lines ls 10,\

prec(0.4,x) title ” with lines ls 10,\

prec(0.3,x) title ” with lines ls 10,\

prec(0.2,x) title ” with lines ls 10,\

prec(0.1,x) title ” with lines ls 10

Posted by Robert Jäschke on July 3rd, 2013.

Thanks Robert! I have to warn you though, whenever I tried to use these graphs in a paper, the reviewers hated it :)

Posted by gromgull on July 12th, 2013.

[…] f-measure values as height-lines from within python. Actually Gunnar was the one who had this idea quite a while ago, but constantly writing things into files, then loading them with his R code to visualize them, […]

Posted by Precision-Recall diagrams including F-Measure height lines | Jörn's Blog on October 28th, 2014.