{
  "id": 398103,
  "title": "Can the predicted value be negative?",
  "url": "/competitions/tlvmc-parkinsons-freezing-gait-prediction/discussion/398103",
  "author_name": "",
  "post_date": "2023-03-28T15:04:07.831453100Z",
  "votes": 1,
  "comment_count": 4,
  "views": 0,
  "content": "<p>I take this notebooks as an example:</p>\n<p><a href=\"https://www.kaggle.com/code/mayukh18/pytorch-fog-end-to-end-baseline-lb-0-254/output?select=submission.csv\" target=\"_blank\">https://www.kaggle.com/code/mayukh18/pytorch-fog-end-to-end-baseline-lb-0-254/output?select=submission.csv</a></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F13344555%2F060df6032c97f99f34b1966208a49b55%2F338418574_124551580488686_5917250813202182623_n.png?generation=1680015723098048&amp;alt=media\" alt=\"\"></p>\n<p>And i have more question:</p>\n<p>real_values = [0, 0, 1] (List contains target values)<br>\npredict_values = [0.02, 0.03, 0.04] (List contains values predicted)</p>\n<p>How can I calculate mAP ? (It would be nice if it could be explained with a mathematical formula)</p>",
  "messages": [
    {
      "id": "2200450",
      "postDate": "03/28/2023 15:04:07",
      "content": "<p>I take this notebooks as an example:</p>\n<p><a href=\"https://www.kaggle.com/code/mayukh18/pytorch-fog-end-to-end-baseline-lb-0-254/output?select=submission.csv\" target=\"_blank\">https://www.kaggle.com/code/mayukh18/pytorch-fog-end-to-end-baseline-lb-0-254/output?select=submission.csv</a></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F13344555%2F060df6032c97f99f34b1966208a49b55%2F338418574_124551580488686_5917250813202182623_n.png?generation=1680015723098048&amp;alt=media\" alt=\"\"></p>\n<p>And i have more question:</p>\n<p>real_values = [0, 0, 1] (List contains target values)<br>\npredict_values = [0.02, 0.03, 0.04] (List contains values predicted)</p>\n<p>How can I calculate mAP ? (It would be nice if it could be explained with a mathematical formula)</p>",
      "rawMarkdown": "I take this notebooks as an example:\n\nhttps://www.kaggle.com/code/mayukh18/pytorch-fog-end-to-end-baseline-lb-0-254/output?select=submission.csv\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F13344555%2F060df6032c97f99f34b1966208a49b55%2F338418574_124551580488686_5917250813202182623_n.png?generation=1680015723098048&alt=media)\n\nAnd i have more question:\n\nreal_values = [0, 0, 1] (List contains target values)\npredict_values = [0.02, 0.03, 0.04] (List contains values predicted)\n\nHow can I calculate mAP ? (It would be nice if it could be explained with a mathematical formula)",
      "votes": null
    },
    {
      "id": "2200478",
      "postDate": "03/28/2023 15:23:13",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/jjleesunny\" target=\"_blank\">@jjleesunny</a>,</p>\n<p>The AP metric takes <em>confidence scores</em>, which can be any number. The predictions are ranked by their confidence scores and then a precision and recall is calculated for each rank threshold. The average of the precision scores weighted by the change in recall is the Average Precision for that class.</p>\n<p>Note that it's only the relative <em>ordering</em> of the confidence scores that matters, so they can indeed be negative. The AP is just like AUCROC, but with precision and recall instead of sensitivity and 1-specificity.</p>\n<p>You can find more details and a formula on <a href=\"https://scikit-learn.org/stable/modules/generated/sklearn.metrics.average_precision_score.html\" target=\"_blank\">this page</a> from the sklearn documentation.</p>\n<p>Hope this answers your question!</p>",
      "rawMarkdown": "Hi @jjleesunny,\n\nThe AP metric takes *confidence scores*, which can be any number. The predictions are ranked by their confidence scores and then a precision and recall is calculated for each rank threshold. The average of the precision scores weighted by the change in recall is the Average Precision for that class.\n\nNote that it's only the relative *ordering* of the confidence scores that matters, so they can indeed be negative. The AP is just like AUCROC, but with precision and recall instead of sensitivity and 1-specificity.\n\nYou can find more details and a formula on [this page](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.average_precision_score.html) from the sklearn documentation.\n\nHope this answers your question!",
      "votes": null
    },
    {
      "id": "2200501",
      "postDate": "03/28/2023 15:37:08",
      "content": "<p>Thanks for very detailed explanation.</p>",
      "rawMarkdown": "Thanks for very detailed explanation.",
      "votes": null
    },
    {
      "id": "2257806",
      "postDate": "05/13/2023 17:08:24",
      "content": "<p>Hi jjleesunny, how did you calculate mAP? because sklearn function only support binary calssification. Did you train 3 binary classification models and then used sklearn to calculate mAP?</p>",
      "rawMarkdown": "Hi jjleesunny, how did you calculate mAP? because sklearn function only support binary calssification. Did you train 3 binary classification models and then used sklearn to calculate mAP?",
      "votes": null
    },
    {
      "id": "2292415",
      "postDate": "06/08/2023 10:26:26",
      "content": "<p>Negative values of predicted Turn/StartHesitation/Walk don't make sense, do they?</p>",
      "rawMarkdown": "Negative values of predicted Turn/StartHesitation/Walk don't make sense, do they?",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2200478,
      "author_name": "ryanholbrook",
      "author_url": "",
      "post_date": "03/28/2023 15:23:13",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/jjleesunny\" target=\"_blank\">@jjleesunny</a>,</p>\n<p>The AP metric takes <em>confidence scores</em>, which can be any number. The predictions are ranked by their confidence scores and then a precision and recall is calculated for each rank threshold. The average of the precision scores weighted by the change in recall is the Average Precision for that class.</p>\n<p>Note that it's only the relative <em>ordering</em> of the confidence scores that matters, so they can indeed be negative. The AP is just like AUCROC, but with precision and recall instead of sensitivity and 1-specificity.</p>\n<p>You can find more details and a formula on <a href=\"https://scikit-learn.org/stable/modules/generated/sklearn.metrics.average_precision_score.html\" target=\"_blank\">this page</a> from the sklearn documentation.</p>\n<p>Hope this answers your question!</p>",
      "votes": null,
      "replies": [
        {
          "id": 2200501,
          "author_name": "jjleesunny",
          "author_url": "",
          "post_date": "03/28/2023 15:37:08",
          "content": "<p>Thanks for very detailed explanation.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 2292415,
          "author_name": "sdelnikovaleksandr",
          "author_url": "",
          "post_date": "06/08/2023 10:26:26",
          "content": "<p>Negative values of predicted Turn/StartHesitation/Walk don't make sense, do they?</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 2257806,
      "author_name": "aidvpr",
      "author_url": "",
      "post_date": "05/13/2023 17:08:24",
      "content": "<p>Hi jjleesunny, how did you calculate mAP? because sklearn function only support binary calssification. Did you train 3 binary classification models and then used sklearn to calculate mAP?</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2200450": "I take this notebooks as an example:\n\nhttps://www.kaggle.com/code/mayukh18/pytorch-fog-end-to-end-baseline-lb-0-254/output?select=submission.csv\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F13344555%2F060df6032c97f99f34b1966208a49b55%2F338418574_124551580488686_5917250813202182623_n.png?generation=1680015723098048&alt=media)\n\nAnd i have more question:\n\nreal_values = [0, 0, 1] (List contains target values)\npredict_values = [0.02, 0.03, 0.04] (List contains values predicted)\n\nHow can I calculate mAP ? (It would be nice if it could be explained with a mathematical formula)",
    "2200478": "Hi @jjleesunny,\n\nThe AP metric takes *confidence scores*, which can be any number. The predictions are ranked by their confidence scores and then a precision and recall is calculated for each rank threshold. The average of the precision scores weighted by the change in recall is the Average Precision for that class.\n\nNote that it's only the relative *ordering* of the confidence scores that matters, so they can indeed be negative. The AP is just like AUCROC, but with precision and recall instead of sensitivity and 1-specificity.\n\nYou can find more details and a formula on [this page](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.average_precision_score.html) from the sklearn documentation.\n\nHope this answers your question!",
    "2200501": "Thanks for very detailed explanation.",
    "2257806": "Hi jjleesunny, how did you calculate mAP? because sklearn function only support binary calssification. Did you train 3 binary classification models and then used sklearn to calculate mAP?",
    "2292415": "Negative values of predicted Turn/StartHesitation/Walk don't make sense, do they?"
  },
  "source": "meta"
}