{
  "id": 252076,
  "title": "Is tf AUC curve='PR' equal to mAP for classif ?",
  "url": "/competitions/siim-covid19-detection/discussion/252076",
  "author_name": "",
  "post_date": "2021-07-10T10:14:52.399871500Z",
  "votes": 4,
  "comment_count": 5,
  "views": 0,
  "content": "<p>tf.metrics.AUC(multi_label = True, curve='PR') is it mAP for classification ? The mAP metric is so obscur …</p>",
  "messages": [
    {
      "id": "1382913",
      "postDate": "07/10/2021 10:14:52",
      "content": "<p>tf.metrics.AUC(multi_label = True, curve='PR') is it mAP for classification ? The mAP metric is so obscur …</p>",
      "rawMarkdown": "tf.metrics.AUC(multi_label = True, curve='PR') is it mAP for classification ? The mAP metric is so obscur ...",
      "votes": null
    },
    {
      "id": "1383337",
      "postDate": "07/10/2021 18:26:39",
      "content": "<p>i am not sure but you can use sklearn average_precision_score for studylevel map calculation </p>",
      "rawMarkdown": "i am not sure but you can use sklearn average_precision_score for studylevel map calculation",
      "votes": null
    },
    {
      "id": "1383559",
      "postDate": "07/11/2021 02:51:01",
      "content": "<p>They are slightly different but similar. In the plot below, the blue line is the PR curve. And the <code>mAP</code> metric is not the area under the blue line but rather the area under the orange line. The difference between the blue and orange line is that you take the PR curve and replace every diagonal line with a maximal horizontal line. Blog reference <a href=\"https://towardsdatascience.com/breaking-down-mean-average-precision-map-ae462f623a52\" target=\"_blank\">here</a></p>\n<p><img src=\"https://miro.medium.com/max/1400/1*Uhs5RacJtH3og8tvH5rctQ.png\" alt=\"\"></p>",
      "rawMarkdown": "They are slightly different but similar. In the plot below, the blue line is the PR curve. And the `mAP` metric is not the area under the blue line but rather the area under the orange line. The difference between the blue and orange line is that you take the PR curve and replace every diagonal line with a maximal horizontal line. Blog reference [here][1]\n\n![](https://miro.medium.com/max/1400/1*Uhs5RacJtH3og8tvH5rctQ.png)\n\n[1]: https://towardsdatascience.com/breaking-down-mean-average-precision-map-ae462f623a52",
      "votes": null
    },
    {
      "id": "1383733",
      "postDate": "07/11/2021 07:43:55",
      "content": "<p>Thanks for your clear answer ! Then if I set summation_method to 'majoring', does it do the trick ? <a href=\"https://www.tensorflow.org/api_docs/python/tf/keras/metrics/AUC\" target=\"_blank\">https://www.tensorflow.org/api_docs/python/tf/keras/metrics/AUC</a></p>",
      "rawMarkdown": "Thanks for your clear answer ! Then if I set summation_method to 'majoring', does it do the trick ? https://www.tensorflow.org/api_docs/python/tf/keras/metrics/AUC",
      "votes": null
    },
    {
      "id": "1384165",
      "postDate": "07/11/2021 14:11:06",
      "content": "<p>According to the description, <code>summation_method</code> does</p>\n<blockquote>\n  <p>For PR-AUC, interpolates (true/false) positives but not the ratio that is precision (see Davis &amp; Goadrich 2006 for details); 'minoring' applies left summation for increasing intervals and right summation for decreasing intervals; 'majoring' does the opposite.</p>\n</blockquote>\n<p>I don't think this does the trick. When using <code>Riemann sum</code>, i think the interval for calculation is small. For example in the plot above, to get the orange line, you would need to have an interval of <code>Recall = 0.3</code> to capture the entire increasing interval between <code>0.35 to 0.65</code>. However Keras is probably using lots of little intervals. Therefore you would get the following picture (but I could be wrong).<br>\n<img src=\"https://www.ccom.ucsd.edu/~cdeotte/Kaggle/slope-7-11-21.png\" alt=\"\"></p>",
      "rawMarkdown": "According to the description, `summation_method` does\n> For PR-AUC, interpolates (true/false) positives but not the ratio that is precision (see Davis & Goadrich 2006 for details); 'minoring' applies left summation for increasing intervals and right summation for decreasing intervals; 'majoring' does the opposite.\n\nI don't think this does the trick. When using `Riemann sum`, i think the interval for calculation is small. For example in the plot above, to get the orange line, you would need to have an interval of `Recall = 0.3` to capture the entire increasing interval between `0.35 to 0.65`. However Keras is probably using lots of little intervals. Therefore you would get the following picture (but I could be wrong).\n![](https://www.ccom.ucsd.edu/~cdeotte/Kaggle/slope-7-11-21.png)",
      "votes": null
    },
    {
      "id": "1386335",
      "postDate": "07/13/2021 12:23:19",
      "content": "<p>Is there any tensorflow implementation for mAP?</p>",
      "rawMarkdown": "Is there any tensorflow implementation for mAP?",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1383337,
      "author_name": "trooperog",
      "author_url": "",
      "post_date": "07/10/2021 18:26:39",
      "content": "<p>i am not sure but you can use sklearn average_precision_score for studylevel map calculation </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1383559,
      "author_name": "cdeotte",
      "author_url": "",
      "post_date": "07/11/2021 02:51:01",
      "content": "<p>They are slightly different but similar. In the plot below, the blue line is the PR curve. And the <code>mAP</code> metric is not the area under the blue line but rather the area under the orange line. The difference between the blue and orange line is that you take the PR curve and replace every diagonal line with a maximal horizontal line. Blog reference <a href=\"https://towardsdatascience.com/breaking-down-mean-average-precision-map-ae462f623a52\" target=\"_blank\">here</a></p>\n<p><img src=\"https://miro.medium.com/max/1400/1*Uhs5RacJtH3og8tvH5rctQ.png\" alt=\"\"></p>",
      "votes": null,
      "replies": [
        {
          "id": 1383733,
          "author_name": "josephamigo",
          "author_url": "",
          "post_date": "07/11/2021 07:43:55",
          "content": "<p>Thanks for your clear answer ! Then if I set summation_method to 'majoring', does it do the trick ? <a href=\"https://www.tensorflow.org/api_docs/python/tf/keras/metrics/AUC\" target=\"_blank\">https://www.tensorflow.org/api_docs/python/tf/keras/metrics/AUC</a></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1384165,
          "author_name": "cdeotte",
          "author_url": "",
          "post_date": "07/11/2021 14:11:06",
          "content": "<p>According to the description, <code>summation_method</code> does</p>\n<blockquote>\n  <p>For PR-AUC, interpolates (true/false) positives but not the ratio that is precision (see Davis &amp; Goadrich 2006 for details); 'minoring' applies left summation for increasing intervals and right summation for decreasing intervals; 'majoring' does the opposite.</p>\n</blockquote>\n<p>I don't think this does the trick. When using <code>Riemann sum</code>, i think the interval for calculation is small. For example in the plot above, to get the orange line, you would need to have an interval of <code>Recall = 0.3</code> to capture the entire increasing interval between <code>0.35 to 0.65</code>. However Keras is probably using lots of little intervals. Therefore you would get the following picture (but I could be wrong).<br>\n<img src=\"https://www.ccom.ucsd.edu/~cdeotte/Kaggle/slope-7-11-21.png\" alt=\"\"></p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1386335,
      "author_name": "vatsalmavani",
      "author_url": "",
      "post_date": "07/13/2021 12:23:19",
      "content": "<p>Is there any tensorflow implementation for mAP?</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1382913": "tf.metrics.AUC(multi_label = True, curve='PR') is it mAP for classification ? The mAP metric is so obscur ...",
    "1383337": "i am not sure but you can use sklearn average_precision_score for studylevel map calculation",
    "1383559": "They are slightly different but similar. In the plot below, the blue line is the PR curve. And the `mAP` metric is not the area under the blue line but rather the area under the orange line. The difference between the blue and orange line is that you take the PR curve and replace every diagonal line with a maximal horizontal line. Blog reference [here][1]\n\n![](https://miro.medium.com/max/1400/1*Uhs5RacJtH3og8tvH5rctQ.png)\n\n[1]: https://towardsdatascience.com/breaking-down-mean-average-precision-map-ae462f623a52",
    "1383733": "Thanks for your clear answer ! Then if I set summation_method to 'majoring', does it do the trick ? https://www.tensorflow.org/api_docs/python/tf/keras/metrics/AUC",
    "1384165": "According to the description, `summation_method` does\n> For PR-AUC, interpolates (true/false) positives but not the ratio that is precision (see Davis & Goadrich 2006 for details); 'minoring' applies left summation for increasing intervals and right summation for decreasing intervals; 'majoring' does the opposite.\n\nI don't think this does the trick. When using `Riemann sum`, i think the interval for calculation is small. For example in the plot above, to get the orange line, you would need to have an interval of `Recall = 0.3` to capture the entire increasing interval between `0.35 to 0.65`. However Keras is probably using lots of little intervals. Therefore you would get the following picture (but I could be wrong).\n![](https://www.ccom.ucsd.edu/~cdeotte/Kaggle/slope-7-11-21.png)",
    "1386335": "Is there any tensorflow implementation for mAP?"
  },
  "source": "meta"
}