#!/usr/bin/gawk -f #/* vim: set filteype=awk : */ -*- awk -*- BEGIN{ FS = " *, *"; } /^ *\#/ { print $0 ", !pf, f-measure" ; next} /[:alnum:]*,/{ notfp = notFP($15/100); fmeas = getF($16/100, $14/100); # bal = getB($10/100, $11/100); print $0 ", " (notfp * 100) ", " (fmeas *100)# ", " (bal * 100); next; } function getF(prec, rec) { fm = (2 * rec * prec); fm = fm/(rec + prec +.00000000000000000001); return fm; } function getB(pd, pf) { pfs = (0-pf); pds = (1-pd); bal = sqrt((pfs*pfs)+(pds*pds)); bal = bal/sqrt(2); return bal; } function notFP(pf) { return (1 - pf); }