编程介的小学生 2017-11-04 12:51 采纳率: 20.5%
浏览 918
已采纳

MAP

Problem Description
Many people get information from Baidu、Google、Bing and so on. OK, now we will consider how to test the performance of a search system.
The testing is based on an annotation file,annotation file consist of some query,every query has a query word and many reference URL. For example,“MM xxoo.com ooxx.com xoxo.com”,“MM”is the query word and “xxoo.com ooxx.com xoxo.com”is the reference URL.
If we search the query word from search system, we can also get a result list, and then we can test the search performance by the result list and annotation file. You job is calculate the MAP of the search performance. The definition of MAP is:
Rank:
Position of a retrieved URL in the list of retrieved list.
Precision at a given cut-off rank r for a single query:
P(r) = (number of relevant URL of rank r or less) / r
Average precision: defined as follows

Where N is the number of retrieved URL, R is the number of relevant URL, and rel(r) = 1 if URL at rank r is relevant, 0 otherwise.
Mean average precision: average precision for a set of queries is defined as follows:

Where Q is the number of queries.

Input
The first line of input contains T, the number of test cases.
For each test case start with a number n, the query number of annotation file. Then follows 2n lines, the first n lines are the annotation, every line means a query that has a word in front and the reference URL followed. The next n lines are the search result of the queries in annotation, every line means the search result of a query that has the search word in front and the retrieved URL followed.
n <= 100.
The length of a line <= 10000.
The length of a URL and word <= 50.

Output
Case number ant the MAP value with 6 digits after decimal point.

Sample Input
1
3
Banana banana.com
Apple iphone.com ipad.com
Software Microsoft.com IBM.com Google.com
Banana asd.com banana.com
Apple gdfgd.com iphone.com ipad.com
Software gdf.com wer.com tre.com

Sample Output
Case #1: 0.361111

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
  • ¥20 怎么在stm32门禁成品上增加查询记录功能
  • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面
  • ¥50 NT4.0系统 STOP:0X0000007B
  • ¥15 想问一下stata17中这段代码哪里有问题呀
  • ¥15 flink cdc无法实时同步mysql数据
  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决