MAP(Mean Average Precision)

本文深入解析了MAP(Mean Average Precision)和MRR(Mean Reciprocal Rank)在信息检索领域的核心概念及计算方法。通过具体实例,展示了如何评估系统在返回相关文档上的性能,特别是强调了排名相关文档的重要性。文章还讨论了这两个指标在不同场景下的应用,为读者提供了一种全面评估信息检索系统效能的视角。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

MAP(Mean Average Precision):单个主题的平均准确率是每篇相关文档检索出后的准确率的平均值。主集合的平均准确率(MAP)是每个主题的平均准确率的平均值。 MAP 是反映系统在全部相关文档上性能的单值指标。系统检索出来的相关文档越靠前(rank 越高),MAP就可能越高。如果系统没有返回相关文档,则准确率默认为0。
例如:假设有两个主题,主题1有4个相关网页,主题2有5个相关网页。某系统对于主题1检索出4个相关网页,其rank分别为1, 2, 4, 7;对于主题2检索出3个相关网页,其rank分别为1,3,5。对于主题1,平均准确率为(1/1+2/2+3/4+4/7)/4=0.83。对于主题 2,平均准确率为(1/1+2/3+3/5+0+0)/5=0.45。则MAP= (0.83+0.45)/2=0.64。”

MRR是把标准答案在被评价系统给出结果中的排序取倒数作为它的准确度,再对所有的问题取平均。

Wiki

Precision and recall are single-value metrics based on the whole list of documents returned by the system. For systems that return a ranked sequence of documents, it is desirable to also consider the order in which the returned documents are presented. Average precision emphasizes ranking relevant documents higher. It is the average of precisions computed at the point of each of the relevant documents in the ranked sequence:

 \operatorname{AveP} = \frac{\sum_{r=1}^N (P(r) \times \mathrm{rel}(r))}{\mbox{number of relevant documents}} \!


where r is the rank, N the number retrieved, rel() a binary function on the relevance of a given rank, and P(r) precision at a given cut-off rank:

 \mbox{P(r)} = \frac{|\{\mbox{relevant retrieved documents of rank r or less}\}|}{r}

This metric is also sometimes referred to geometrically as the area under the Precision-Recall curve.

Note that the denominator (number of relevant documents) is the number of relevant documents in the entire collection, so that the metric reflects performance over all relevant documents, regardless of a retrieval cutoff. See:.

^ Turpin, Andrew; Scholer, Falk (2006). "User performance versus precision measures for simple search tasks". Proceedings of the 29th Annual international ACM SIGIR Conference on Research and Development in information Retrieval_r(Seattle, Washington, USA, August 06-11, 2006) (New York, NY: ACM): 11–18. doi:10.1145/1148170.1148176


转自: http://blog.sina.com.cn/s/blog_662234020100pozd.html
### Mean Average Precision (mAP) 的定义 Mean Average Precision (mAP) 是一种广泛用于评估信息检索系统和目标检测模型性能的度量标准。该指标综合考虑了查准率(Precision) 和查全率(Recall),能够更全面地反映系统的整体表现。 在信息检索领域,mAP 表示的是所有查询平均精度的均值[^3]。对于每一个单独的查询请求而言,先计算其对应的 AP 值(Average Precision),再取这些 AP 值的算术平均即得到最终的 mAP 结果。 而在对象检测任务中,mAP 则衡量不同类别上预测框与真实标注框之间的匹配程度。具体来说,针对每一类物体分别统计 TP(True Positive), FP(False Positive) 及 FN(False Negative)[^1]。 ### 计算方法 #### 对于信息检索: 1. 针对单个查询 q,按照文档的相关性得分排序; 2. 根据实际相关情况标记每个返回项是否为正样本; 3. 使用下列公式逐个位置 i 更新当前累计 P@i(Precision at position i),其中 rel(i)=1 若第 i 位是相关项目,否则为0;nrel(q)表示查询q下的总相关数: \[ \text{P}(i|q) = \frac{\sum_{j=1}^{i}\mathrm{rel(j)}}{i},\quad \forall i : \mathrm{rel}(i)=1 \] 4. 将上述过程中获得的所有非零 P@i 平均化作为此查询 Q 下的 AP 值; 5. 最终通过求解所有测试集中各查询下 AP 的简单平均值得到整个数据集上的 mAP。 #### 对象检测中的实现方式略有差异: - 主要区别在于如何判断两个边界框之间是否存在重叠以及设定 IoU(Intersection over Union)阈值来决定真阳性和假阳性。 - 当前普遍采用 COCO 数据集所使用的评价方案,在多个不同的 IoU 阈值水平上来累积 PR 曲线并据此得出每种类别的 AP 后再次做平均形成全局 mAP 指标。 ```python def calculate_map(precisions, recalls): """ Calculate mean average precision given lists of precisions and recalls. Args: precisions (list): List containing precision values. recalls (list): List containing recall values. Returns: float: Calculated MAP value. """ aps = [] unique_recalls = sorted(set(recalls)) for r in unique_recalls: p_interpolated = max([p for p, rec in zip(precisions, recalls) if rec >= r], default=0) aps.append(p_interpolated) return sum(aps)/len(unique_recalls) if len(unique_recalls)>0 else 0 ```
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值