mAP:全称mean average precision(平均准确率),信息检索中常用的评价指标(可参考 信息检索的评价指标(Precision, Recall, F-score, MAP) )。
每一次检索结果的好坏通过AP(average precision)来衡量,mAP则为多次检索,取其平均值。
AP的计算
摘自:https://www.kaggle.com/wiki/MeanAveragePrecision
the average precision at n for this user is:
ap@n=∑k=1nP(k)/min(m,n)where P(k) means the precision at cut-off k in the item list, i.e., the ratio of number of recommended nodes followed, up to the position k, over the number k; P(k) equals 0 when the k-th item is not followed upon recommendation; m is the number of relevant nodes; n is the number of predicted nodes. If the denominator is zero, P(k)/min(m,n) is set to zero.
n可以理解为检索时前n个最相关匹配项,即top-n。P(K)表示前 k(k = 1,2, … ,n)项中,设与查询对象groundtruth一致的匹配项个数为x,则 P(k)=xk 。如果 第 k 项的groundtruth不匹配,P(k)即为0。 分母中m表示数据库中总的与检索对象groundtruth一致的数目,一般的m是远大于n的。比如说一种情况:数据库中总共与xx查询相关的对象只有3(m=3)个,当然前10(n=10)个相关项中最多只有3个正确匹配项,如果还将分母设为10的话,当然错了。
具体应用
假设有两个主题,主题1有4个相关网页,主题2有5个相关网页。某系统对于主题1检索出4个相关网页,其rank分别为1, 2, 4, 7;对于主题2检索出3个相关网页,其rank分别为1,3,5。
这里取top-10(注意 m < n):
对于主题1,平均准确率为
(1/1+2/2+3/4+4/7)/4=0.83
。
对于主题 2,平均准确率为
(1/1+2/3+3/5)/5=0.45
。
则
mAP@10=(0.83+0.45)/2=0.64
。
附知乎上的一张图片: