- 论坛徽章:
- 780
|
回复 72# wlyqiqi - awk 'NR==FNR{a[$1" "$3];c[$1];count[$1]++;next} {if($1" "$3 in a){APtmp[$1" "A[$1]]=++A[$1]/++$4}else B[$1]++;b[$1" "$3]} END{for(i in a){split(i,key," ");k=key[1];if(!(i in b))C[k]++};for(i in APtmp){split(i,key," ");k=key[1];AP[k]+=APtmp[i]} print "key\t准确率\t召回率\tF1\tAP";for(i in c){P=(A[i]+B[i])>0?A[i]/(A[i]+B[i]):0;R=(A[i]+C[i])>0?A[i]/(A[i]+C[i]):0;F1=(P+R)>0?2*P*R/(P+R):0;APi=AP[i]/count[i];printf "%s\t%.4f\t%.4f\t%.4f\t%.4f\n",i,P,R,F1,APi}}' training.qrels TF_IDF_0.res|sort -n -k1
复制代码 希望你能搞定吧,我基本很难再帮上了,
没办法运行看结果。
|
|