{
  "id": 521853,
  "title": "What is the sample weight?",
  "url": "/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/521853",
  "author_name": "",
  "post_date": "2024-07-23T09:32:23.224216900Z",
  "votes": null,
  "comment_count": 2,
  "views": 0,
  "content": "<p>I might miss something, and come here for clarification.</p>\n<p>In the <a href=\"https://www.kaggle.com/code/metric/rsna-lumbar-metric-71549\" target=\"_blank\">official metric</a>, the condition loss is calculated as </p>\n<pre><code>condition_loss = sklearn(\n        y_true=solution,\n        y_pred=submission,\n        sample_weight=solution\n)\n</code></pre>\n<p>It means that there is a <strong>sample_weight</strong> column in the solution, which might take the severity into account. I see the famous <a href=\"https://www.kaggle.com/code/itsuki9180/rsna2024-lsdc-training-baseline\" target=\"_blank\">notebook</a> from <a href=\"https://www.kaggle.com/itsuki9180\" target=\"_blank\">@itsuki9180</a> use the following sample weight.</p>\n<pre><code> l  labels:\n     ==0: weights.append(1)\n    elif ==1: weights.append(2)\n    elif ==2: weights.append(4)\n    : weights.append(0)\ncv2 = log_loss(labels, y_pred2, =, =weights)\n</code></pre>\n<p>I.e. 1 for Normal/Mild, 2 for Moderate and 4 for Severe. Is this sample weight announced somewhere? Or it is set by ourselves to minic the official metric? If it is set by ourselves, do you have a better sample weight?</p>",
  "messages": [
    {
      "id": "2932811",
      "postDate": "07/23/2024 09:32:23",
      "content": "<p>I might miss something, and come here for clarification.</p>\n<p>In the <a href=\"https://www.kaggle.com/code/metric/rsna-lumbar-metric-71549\" target=\"_blank\">official metric</a>, the condition loss is calculated as </p>\n<pre><code>condition_loss = sklearn(\n        y_true=solution,\n        y_pred=submission,\n        sample_weight=solution\n)\n</code></pre>\n<p>It means that there is a <strong>sample_weight</strong> column in the solution, which might take the severity into account. I see the famous <a href=\"https://www.kaggle.com/code/itsuki9180/rsna2024-lsdc-training-baseline\" target=\"_blank\">notebook</a> from <a href=\"https://www.kaggle.com/itsuki9180\" target=\"_blank\">@itsuki9180</a> use the following sample weight.</p>\n<pre><code> l  labels:\n     ==0: weights.append(1)\n    elif ==1: weights.append(2)\n    elif ==2: weights.append(4)\n    : weights.append(0)\ncv2 = log_loss(labels, y_pred2, =, =weights)\n</code></pre>\n<p>I.e. 1 for Normal/Mild, 2 for Moderate and 4 for Severe. Is this sample weight announced somewhere? Or it is set by ourselves to minic the official metric? If it is set by ourselves, do you have a better sample weight?</p>",
      "rawMarkdown": "I might miss something, and come here for clarification.\n\nIn the [official metric](https://www.kaggle.com/code/metric/rsna-lumbar-metric-71549), the condition loss is calculated as \n\n```\ncondition_loss = sklearn.metrics.log_loss(\n        y_true=solution.loc[condition_indices, target_levels].values,\n        y_pred=submission.loc[condition_indices, target_levels].values,\n        sample_weight=solution.loc[condition_indices, 'sample_weight'].values\n)\n```\nIt means that there is a **sample_weight** column in the solution, which might take the severity into account. I see the famous [notebook](https://www.kaggle.com/code/itsuki9180/rsna2024-lsdc-training-baseline) from @itsuki9180 use the following sample weight.\n```\nfor l in labels:\n    if l==0: weights.append(1)\n    elif l==1: weights.append(2)\n    elif l==2: weights.append(4)\n    else: weights.append(0)\ncv2 = log_loss(labels, y_pred2, normalize=True, sample_weight=weights)\n```\nI.e. 1 for Normal/Mild, 2 for Moderate and 4 for Severe. Is this sample weight announced somewhere? Or it is set by ourselves to minic the official metric? If it is set by ourselves, do you have a better sample weight?",
      "votes": null
    },
    {
      "id": "2932854",
      "postDate": "07/23/2024 09:51:33",
      "content": "<p>Sample weight is given here: <a href=\"https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/overview/evaluation\" target=\"_blank\">Evaluation</a>. For completeness, here is what is given:</p>\n<blockquote>\n  <p>The sample weights are as follows:<br>\n  1 for normal/mild.<br>\n  2 for moderate.<br>\n  4 for severe.</p>\n</blockquote>",
      "rawMarkdown": "Sample weight is given here: [Evaluation](https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/overview/evaluation). For completeness, here is what is given:\n>The sample weights are as follows:\n1 for normal/mild.\n2 for moderate.\n4 for severe.",
      "votes": null
    },
    {
      "id": "2932935",
      "postDate": "07/23/2024 10:51:49",
      "content": "<p>I ignore that information.  Really thank you</p>",
      "rawMarkdown": "I ignore that information.  Really thank you",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2932854,
      "author_name": "coderrkj",
      "author_url": "",
      "post_date": "07/23/2024 09:51:33",
      "content": "<p>Sample weight is given here: <a href=\"https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/overview/evaluation\" target=\"_blank\">Evaluation</a>. For completeness, here is what is given:</p>\n<blockquote>\n  <p>The sample weights are as follows:<br>\n  1 for normal/mild.<br>\n  2 for moderate.<br>\n  4 for severe.</p>\n</blockquote>",
      "votes": null,
      "replies": [
        {
          "id": 2932935,
          "author_name": "baohaoliao",
          "author_url": "",
          "post_date": "07/23/2024 10:51:49",
          "content": "<p>I ignore that information.  Really thank you</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2932811": "I might miss something, and come here for clarification.\n\nIn the [official metric](https://www.kaggle.com/code/metric/rsna-lumbar-metric-71549), the condition loss is calculated as \n\n```\ncondition_loss = sklearn.metrics.log_loss(\n        y_true=solution.loc[condition_indices, target_levels].values,\n        y_pred=submission.loc[condition_indices, target_levels].values,\n        sample_weight=solution.loc[condition_indices, 'sample_weight'].values\n)\n```\nIt means that there is a **sample_weight** column in the solution, which might take the severity into account. I see the famous [notebook](https://www.kaggle.com/code/itsuki9180/rsna2024-lsdc-training-baseline) from @itsuki9180 use the following sample weight.\n```\nfor l in labels:\n    if l==0: weights.append(1)\n    elif l==1: weights.append(2)\n    elif l==2: weights.append(4)\n    else: weights.append(0)\ncv2 = log_loss(labels, y_pred2, normalize=True, sample_weight=weights)\n```\nI.e. 1 for Normal/Mild, 2 for Moderate and 4 for Severe. Is this sample weight announced somewhere? Or it is set by ourselves to minic the official metric? If it is set by ourselves, do you have a better sample weight?",
    "2932854": "Sample weight is given here: [Evaluation](https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/overview/evaluation). For completeness, here is what is given:\n>The sample weights are as follows:\n1 for normal/mild.\n2 for moderate.\n4 for severe.",
    "2932935": "I ignore that information.  Really thank you"
  },
  "source": "meta"
}