Pull request "fix MAP formula" by from
MERGED FROM
" For example, if 1,2,5,7,9 is the ranks of relevant documents (enumerations starts from number 1) from ten retrivied then $P@5$ will be $\\frac{3}{5}$.\n",
"\n",
"* __Mean average precision (MAP)__\n",
- " $$\\frac{1}{|Q|}\\sum_{i} \\frac{1}{|\\mbox{relevant docs}|} \\sum_{k} P@k(q_i, \\{d_{qi}\\}) \\times l_{qi} $$\n",
+ " $$\\frac{1}{|Q|}\\sum_{q \\in Q} \\frac{1}{|\\mbox{relevant docs in } D_q|} \\sum_{k} P@k(q) \\times rel(q, k) $$\n",
" \n",
- " This metric calculates average precision for a query weighted with document relevances and then calculate mean between all queries.\n",
+ " Where $rel(q, k)$ is a relevance label of the document at k-th position in our ranking of $D_q$. This metric calculates average precision for a query weighted with document relevances and then calculate mean between all queries.\n",
" \n",
"* __Discounted cumulative gain (DCG)__\n",
" $$\\sum_{k=1}^{mq} \\frac{2 ^ {l_{qk}}}{\\log_2(k+1)}$$\n",
],
"metadata": {
"kernelspec": {
- "display_name": "Python 2",
+ "display_name": "Python 3",
"language": "python",
- "name": "python2"
+ "name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
- "version": 2
+ "version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.15"
+ "pygments_lexer": "ipython3",
+ "version": "3.7.3"
}
},
"nbformat": 4,
