{
  "id": 520695,
  "title": "help me！Submission Scoring Error！",
  "url": "/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/520695",
  "author_name": "",
  "post_date": "2024-07-17T02:58:50.295704600Z",
  "votes": null,
  "comment_count": 13,
  "views": 0,
  "content": "<p>hye team,I'm facing a problem and have tried many solutions, but nothing is working. I really need help. someone expert help me to fix these :<a href=\"https://www.kaggle.com/code/gtgnhqq/lumbar-competition\" target=\"_blank\">https://www.kaggle.com/code/gtgnhqq/lumbar-competition</a>!<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F20802231%2Fb506973ba1c37713350fb3c66ccb6b2d%2FSnipaste_2024-07-17_10-57-06.png?generation=1721185127828848&amp;alt=media\"></p>",
  "messages": [
    {
      "id": "2925229",
      "postDate": "07/17/2024 02:58:50",
      "content": "<p>hye team,I'm facing a problem and have tried many solutions, but nothing is working. I really need help. someone expert help me to fix these :<a href=\"https://www.kaggle.com/code/gtgnhqq/lumbar-competition\" target=\"_blank\">https://www.kaggle.com/code/gtgnhqq/lumbar-competition</a>!<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F20802231%2Fb506973ba1c37713350fb3c66ccb6b2d%2FSnipaste_2024-07-17_10-57-06.png?generation=1721185127828848&amp;alt=media\"></p>",
      "rawMarkdown": "hye team,I'm facing a problem and have tried many solutions, but nothing is working. I really need help. someone expert help me to fix these :https://www.kaggle.com/code/gtgnhqq/lumbar-competition!\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F20802231%2Fb506973ba1c37713350fb3c66ccb6b2d%2FSnipaste_2024-07-17_10-57-06.png?generation=1721185127828848&alt=media)",
      "votes": null
    },
    {
      "id": "2925317",
      "postDate": "07/17/2024 05:20:42",
      "content": "<p><a href=\"https://www.kaggle.com/gtgnhqq\" target=\"_blank\">@gtgnhqq</a> After checking all your codes are running properly, turn off the internet (Session options &gt;&gt; Internet \"Turn off\").<br>\nTry to save your note book as a public file (share &gt;&gt; Public) <br>\nAnd also Install the required Libraries </p>\n<h1>Install the required libraries</h1>\n<p>!pip install pandas==2.2.2<br>\n!pip install scikit-learn==1.2.2<br>\n!pip install numpy==1.26.4</p>\n<p>For more, check out my notebook, <a href=\"https://www.kaggle.com/code/raja6242/easy-essay-transformer-lal\" target=\"_blank\">Easy Essay Transformer LAL</a></p>",
      "rawMarkdown": "gtgnhqq After checking all your codes are running properly, turn off the internet (Session options >> Internet \"Turn off\").\nTry to save your note book as a public file (share >> Public) \nAnd also Install the required Libraries \n# Install the required libraries\n!pip install pandas==2.2.2\n!pip install scikit-learn==1.2.2\n!pip install numpy==1.26.4\n\nFor more, check out my notebook, [Easy Essay Transformer LAL](https://www.kaggle.com/code/raja6242/easy-essay-transformer-lal)",
      "votes": null
    },
    {
      "id": "2925467",
      "postDate": "07/17/2024 07:40:01",
      "content": "<p>I still haven’t resolved it, and I’ve run out of attempts for today.😭</p>",
      "rawMarkdown": "I still haven’t resolved it, and I’ve run out of attempts for today.😭",
      "votes": null
    },
    {
      "id": "2925536",
      "postDate": "07/17/2024 08:33:59",
      "content": "<p>In your code above,</p>\n<pre><code>T1 = {\n    :[, , ,\n           , ],\n    :[, , ,\n       , , ,\n       , , ,\n       ],\n     : [, , ,\n       , , ,\n       , , ,\n       ],\n}\n</code></pre>\n<p>This mapping is a correct assumption. But the error occurs, I think, when there is missing <code>Sagittal T2/STIR</code> and <code>Sagittal T1</code> series (There are training study cases with is issue). This leads to missing <code>row_id</code> values in final submission.</p>\n<p>My suggestion:</p>\n<ul>\n<li>Read sample_submission.csv. Change the default value of <code>0.3333333333333333</code> if you want to.</li>\n<li>Use <code>combine_first</code> method to fill missing <code>row_id</code> values.</li>\n<li>As an example, in the last cell: </li>\n</ul>\n<pre><code>ss_df = pd.read_csv()\n submission.row_id.isin(ss_df.row_id).() \nsubmission = submission.set_index().combine_first(ss_df.set_index()).reset_index()\nsubmission.to_csv(, index=)\n</code></pre>",
      "rawMarkdown": "In your code above,\n```python\nT1 = {\n    'Sagittal T2/STIR':['spinal_canal_stenosis_l1_l2', 'spinal_canal_stenosis_l2_l3', 'spinal_canal_stenosis_l3_l4',\n           'spinal_canal_stenosis_l4_l5', 'spinal_canal_stenosis_l5_s1'],\n    'Axial T2':['left_subarticular_stenosis_l1_l2', 'left_subarticular_stenosis_l2_l3', 'left_subarticular_stenosis_l3_l4',\n       'left_subarticular_stenosis_l4_l5', 'left_subarticular_stenosis_l5_s1', 'right_subarticular_stenosis_l1_l2',\n       'right_subarticular_stenosis_l2_l3', 'right_subarticular_stenosis_l3_l4', 'right_subarticular_stenosis_l4_l5',\n       'right_subarticular_stenosis_l5_s1'],\n    'Sagittal T1' : ['left_neural_foraminal_narrowing_l1_l2', 'left_neural_foraminal_narrowing_l2_l3', 'left_neural_foraminal_narrowing_l3_l4',\n       'left_neural_foraminal_narrowing_l4_l5', 'left_neural_foraminal_narrowing_l5_s1', 'right_neural_foraminal_narrowing_l1_l2',\n       'right_neural_foraminal_narrowing_l2_l3', 'right_neural_foraminal_narrowing_l3_l4', 'right_neural_foraminal_narrowing_l4_l5',\n       'right_neural_foraminal_narrowing_l5_s1'],\n}\n```\nThis mapping is a correct assumption. But the error occurs, I think, when there is missing `Sagittal T2/STIR` and `Sagittal T1` series (There are training study cases with is issue). This leads to missing `row_id` values in final submission.\n\nMy suggestion:\n- Read sample_submission.csv. Change the default value of `0.3333333333333333` if you want to.\n- Use `combine_first` method to fill missing `row_id` values.\n- As an example, in the last cell: \n```python\nss_df = pd.read_csv(\"/kaggle/input/rsna-2024-lumbar-spine-degenerative-classification/sample_submission.csv\")\nassert submission.row_id.isin(ss_df.row_id).all() # Check if all `row_id` values are valid (Optional)\nsubmission = submission.set_index(\"row_id\").combine_first(ss_df.set_index(\"row_id\")).reset_index()\nsubmission.to_csv('submission.csv', index=False)\n```",
      "votes": null
    },
    {
      "id": "2926785",
      "postDate": "07/18/2024 02:56:50",
      "content": "<p>I still haven't succeeded, and this is my tenth attempt at submission.😭</p>",
      "rawMarkdown": "I still haven't succeeded, and this is my tenth attempt at submission.😭",
      "votes": null
    },
    {
      "id": "2926909",
      "postDate": "07/18/2024 06:01:55",
      "content": "<p>I want to confirm that Version 8 is still getting \"Submission Scoring Error\" and not \"Notebook Threw Exception\".</p>\n<p>If so, assert the following before <code>submission.to_csv('submission.csv', index=False)</code>:</p>\n<ul>\n<li>Assert dtype for last 3 columns are of some float type (or do conversion)</li>\n<li>Assert no NaN values exist in <code>submission</code></li>\n<li>Round the float values to 6 decimals (to prevent exponential notation [e.g.: 1.6e-8])</li>\n</ul>",
      "rawMarkdown": "I want to confirm that Version 8 is still getting \"Submission Scoring Error\" and not \"Notebook Threw Exception\".\n\nIf so, assert the following before `submission.to_csv('submission.csv', index=False)`:\n- Assert dtype for last 3 columns are of some float type (or do conversion)\n- Assert no NaN values exist in `submission`\n- Round the float values to 6 decimals (to prevent exponential notation [e.g.: 1.6e-8])",
      "votes": null
    },
    {
      "id": "2927119",
      "postDate": "07/18/2024 09:19:16",
      "content": "<p>I still haven't succeeded, despite all my attempts. It's so difficult. I've been revising for five days, and I don't understand why I can only submit twice a day. Even failed submissions count towards the submission limit. I'm on the verge of breaking down!!!😭</p>",
      "rawMarkdown": "I still haven't succeeded, despite all my attempts. It's so difficult. I've been revising for five days, and I don't understand why I can only submit twice a day. Even failed submissions count towards the submission limit. I'm on the verge of breaking down!!!😭",
      "votes": null
    },
    {
      "id": "2927123",
      "postDate": "07/18/2024 09:25:18",
      "content": "<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F20802231%2F4a55df458f50c7fc27e52a44cd23b1bf%2FQQ20240718172125.png?generation=1721294547337732&amp;alt=media\"><br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F20802231%2F22fb6e4fdb5a763aa7a0a4a1549e6fb4%2FQQ20240718172141.png?generation=1721294556443629&amp;alt=media\"><br>\nIt still shows a submission scoring error.</p>",
      "rawMarkdown": "![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F20802231%2F4a55df458f50c7fc27e52a44cd23b1bf%2FQQ20240718172125.png?generation=1721294547337732&alt=media)\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F20802231%2F22fb6e4fdb5a763aa7a0a4a1549e6fb4%2FQQ20240718172141.png?generation=1721294556443629&alt=media)\nIt still shows a submission scoring error.",
      "votes": null
    },
    {
      "id": "2927161",
      "postDate": "07/18/2024 09:53:19",
      "content": "<p>Are you ensuring each row still sums to 1 after changing float format etc?</p>",
      "rawMarkdown": "Are you ensuring each row still sums to 1 after changing float format etc?",
      "votes": null
    },
    {
      "id": "2927168",
      "postDate": "07/18/2024 09:58:34",
      "content": "<p>submission[['normal_mild', 'moderate', 'severe']] = submission[['normal_mild', 'moderate', 'severe']].div(submission[['normal_mild', 'moderate', 'severe']].sum(axis=1), axis=0)<br>\nIs it okay if I write it like this?</p>",
      "rawMarkdown": "submission[['normal_mild', 'moderate', 'severe']] = submission[['normal_mild', 'moderate', 'severe']].div(submission[['normal_mild', 'moderate', 'severe']].sum(axis=1), axis=0)\nIs it okay if I write it like this?",
      "votes": null
    },
    {
      "id": "2927174",
      "postDate": "07/18/2024 10:05:01",
      "content": "<p>Just to test if this is the issue, you could set the 3rd column to just be (1-column1-column2) to see if it works. I've had weird problems in that past with rounding, not sure if it's the issue here though</p>",
      "rawMarkdown": "Just to test if this is the issue, you could set the 3rd column to just be (1-column1-column2) to see if it works. I've had weird problems in that past with rounding, not sure if it's the issue here though",
      "votes": null
    },
    {
      "id": "2927402",
      "postDate": "07/18/2024 12:56:41",
      "content": "<p>I still can't get it right; I'm about to collapse.</p>",
      "rawMarkdown": "I still can't get it right; I'm about to collapse.",
      "votes": null
    },
    {
      "id": "2928625",
      "postDate": "07/19/2024 12:38:28",
      "content": "<p><a href=\"https://www.kaggle.com/gtgnhqq\" target=\"_blank\">@gtgnhqq</a> I was able to find the core bug in your code:</p>\n<pre><code>row_ids = submission[].copy()\nsubmission_transformed = submission.groupby().transform()\nsubmission_transformed[] = row_ids\nsubmission = submission_transformed[[, , , ]]\n</code></pre>\n<p>It should be <code>submission = submission.groupby('row_id').mean().reset_index()</code></p>\n<h3>Reason:</h3>\n<p>If you see <code>transform</code> <a href=\"https://pandas.pydata.org/docs/reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html\" target=\"_blank\">documentation</a>:</p>\n<blockquote>\n  <p>Returns a DataFrame having the same indexes as the original object filled with the transformed values.</p>\n</blockquote>\n<p>This means that the duplicate <code>row_id</code> values are still present and <a href=\"https://www.kaggle.com/code/coderrkj/lumbar-competition-debugging-notebook?scriptVersionId=188924486\" target=\"_blank\">Version 2</a> of my modified copy of your original notebook caught that error by adding validation to the <code>merge</code> method: <code>submission = ordered_row_ids.merge(submission, how=\"left\", on=\"row_id\", validate=\"1:1\")</code></p>\n<h3>Additional points:</h3>\n<ul>\n<li><a href=\"https://www.kaggle.com/code/coderrkj/lumbar-competition-debugging-notebook?scriptVersionId=188947891\" target=\"_blank\">Version 3</a> shows how to predict over train images and get score from competition metric.</li>\n<li><a href=\"https://www.kaggle.com/code/coderrkj/lumbar-competition-debugging-notebook?scriptVersionId=188948027\" target=\"_blank\">Version 4</a>, I have disabled this evaluation and submitted it for testing with hidden data (LB: 1.02 with random weights).</li>\n<li>You can submit with <code>FAKE_TEST</code> as True or False as <code>and len(ss_df) &lt;= 25</code> will ensure hidden test case will be evaluated during submission.</li>\n<li>Remove comments on code with <code>## DEBUG</code> above them, when copying the code back to your notebook with trained weights.</li>\n</ul>",
      "rawMarkdown": "gtgnhqq I was able to find the core bug in your code:\n```python\nrow_ids = submission['row_id'].copy()\nsubmission_transformed = submission.groupby('row_id').transform('mean')\nsubmission_transformed['row_id'] = row_ids\nsubmission = submission_transformed[['row_id', 'normal_mild', 'moderate', 'severe']]\n```\nIt should be `submission = submission.groupby('row_id').mean().reset_index()`\n\n### Reason: \nIf you see `transform` [documentation](https://pandas.pydata.org/docs/reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html):\n> Returns a DataFrame having the same indexes as the original object filled with the transformed values.\n\nThis means that the duplicate `row_id` values are still present and [Version 2](https://www.kaggle.com/code/coderrkj/lumbar-competition-debugging-notebook?scriptVersionId=188924486) of my modified copy of your original notebook caught that error by adding validation to the `merge` method: `submission = ordered_row_ids.merge(submission, how=\"left\", on=\"row_id\", validate=\"1:1\")`\n\n### Additional points:\n-  [Version 3](https://www.kaggle.com/code/coderrkj/lumbar-competition-debugging-notebook?scriptVersionId=188947891) shows how to predict over train images and get score from competition metric.\n- [Version 4](https://www.kaggle.com/code/coderrkj/lumbar-competition-debugging-notebook?scriptVersionId=188948027), I have disabled this evaluation and submitted it for testing with hidden data (LB: 1.02 with random weights).\n- You can submit with `FAKE_TEST` as True or False as `and len(ss_df) <= 25` will ensure hidden test case will be evaluated during submission.\n- Remove comments on code with `## DEBUG` above them, when copying the code back to your notebook with trained weights.",
      "votes": null
    },
    {
      "id": "2929637",
      "postDate": "07/20/2024 08:26:00",
      "content": "<p>Thank you so much, I finally succeeded! After so many days, I'm really grateful.</p>",
      "rawMarkdown": "Thank you so much, I finally succeeded! After so many days, I'm really grateful.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2925317,
      "author_name": "raja6242",
      "author_url": "",
      "post_date": "07/17/2024 05:20:42",
      "content": "<p><a href=\"https://www.kaggle.com/gtgnhqq\" target=\"_blank\">@gtgnhqq</a> After checking all your codes are running properly, turn off the internet (Session options &gt;&gt; Internet \"Turn off\").<br>\nTry to save your note book as a public file (share &gt;&gt; Public) <br>\nAnd also Install the required Libraries </p>\n<h1>Install the required libraries</h1>\n<p>!pip install pandas==2.2.2<br>\n!pip install scikit-learn==1.2.2<br>\n!pip install numpy==1.26.4</p>\n<p>For more, check out my notebook, <a href=\"https://www.kaggle.com/code/raja6242/easy-essay-transformer-lal\" target=\"_blank\">Easy Essay Transformer LAL</a></p>",
      "votes": null,
      "replies": [
        {
          "id": 2925467,
          "author_name": "",
          "author_url": "",
          "post_date": "07/17/2024 07:40:01",
          "content": "<p>I still haven’t resolved it, and I’ve run out of attempts for today.😭</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 2925536,
      "author_name": "coderrkj",
      "author_url": "",
      "post_date": "07/17/2024 08:33:59",
      "content": "<p>In your code above,</p>\n<pre><code>T1 = {\n    :[, , ,\n           , ],\n    :[, , ,\n       , , ,\n       , , ,\n       ],\n     : [, , ,\n       , , ,\n       , , ,\n       ],\n}\n</code></pre>\n<p>This mapping is a correct assumption. But the error occurs, I think, when there is missing <code>Sagittal T2/STIR</code> and <code>Sagittal T1</code> series (There are training study cases with is issue). This leads to missing <code>row_id</code> values in final submission.</p>\n<p>My suggestion:</p>\n<ul>\n<li>Read sample_submission.csv. Change the default value of <code>0.3333333333333333</code> if you want to.</li>\n<li>Use <code>combine_first</code> method to fill missing <code>row_id</code> values.</li>\n<li>As an example, in the last cell: </li>\n</ul>\n<pre><code>ss_df = pd.read_csv()\n submission.row_id.isin(ss_df.row_id).() \nsubmission = submission.set_index().combine_first(ss_df.set_index()).reset_index()\nsubmission.to_csv(, index=)\n</code></pre>",
      "votes": null,
      "replies": [
        {
          "id": 2926785,
          "author_name": "",
          "author_url": "",
          "post_date": "07/18/2024 02:56:50",
          "content": "<p>I still haven't succeeded, and this is my tenth attempt at submission.😭</p>",
          "votes": null,
          "replies": [
            {
              "id": 2926909,
              "author_name": "coderrkj",
              "author_url": "",
              "post_date": "07/18/2024 06:01:55",
              "content": "<p>I want to confirm that Version 8 is still getting \"Submission Scoring Error\" and not \"Notebook Threw Exception\".</p>\n<p>If so, assert the following before <code>submission.to_csv('submission.csv', index=False)</code>:</p>\n<ul>\n<li>Assert dtype for last 3 columns are of some float type (or do conversion)</li>\n<li>Assert no NaN values exist in <code>submission</code></li>\n<li>Round the float values to 6 decimals (to prevent exponential notation [e.g.: 1.6e-8])</li>\n</ul>",
              "votes": null,
              "replies": [
                {
                  "id": 2927119,
                  "author_name": "",
                  "author_url": "",
                  "post_date": "07/18/2024 09:19:16",
                  "content": "<p>I still haven't succeeded, despite all my attempts. It's so difficult. I've been revising for five days, and I don't understand why I can only submit twice a day. Even failed submissions count towards the submission limit. I'm on the verge of breaking down!!!😭</p>",
                  "votes": null,
                  "replies": [
                    {
                      "id": 2927123,
                      "author_name": "",
                      "author_url": "",
                      "post_date": "07/18/2024 09:25:18",
                      "content": "<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F20802231%2F4a55df458f50c7fc27e52a44cd23b1bf%2FQQ20240718172125.png?generation=1721294547337732&amp;alt=media\"><br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F20802231%2F22fb6e4fdb5a763aa7a0a4a1549e6fb4%2FQQ20240718172141.png?generation=1721294556443629&amp;alt=media\"><br>\nIt still shows a submission scoring error.</p>",
                      "votes": null,
                      "replies": [
                        {
                          "id": 2927161,
                          "author_name": "johnnyhyland",
                          "author_url": "",
                          "post_date": "07/18/2024 09:53:19",
                          "content": "<p>Are you ensuring each row still sums to 1 after changing float format etc?</p>",
                          "votes": null,
                          "replies": [
                            {
                              "id": 2927168,
                              "author_name": "",
                              "author_url": "",
                              "post_date": "07/18/2024 09:58:34",
                              "content": "<p>submission[['normal_mild', 'moderate', 'severe']] = submission[['normal_mild', 'moderate', 'severe']].div(submission[['normal_mild', 'moderate', 'severe']].sum(axis=1), axis=0)<br>\nIs it okay if I write it like this?</p>",
                              "votes": null,
                              "replies": [
                                {
                                  "id": 2927174,
                                  "author_name": "johnnyhyland",
                                  "author_url": "",
                                  "post_date": "07/18/2024 10:05:01",
                                  "content": "<p>Just to test if this is the issue, you could set the 3rd column to just be (1-column1-column2) to see if it works. I've had weird problems in that past with rounding, not sure if it's the issue here though</p>",
                                  "votes": null,
                                  "replies": [
                                    {
                                      "id": 2927402,
                                      "author_name": "",
                                      "author_url": "",
                                      "post_date": "07/18/2024 12:56:41",
                                      "content": "<p>I still can't get it right; I'm about to collapse.</p>",
                                      "votes": null,
                                      "replies": []
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "id": 2928625,
      "author_name": "coderrkj",
      "author_url": "",
      "post_date": "07/19/2024 12:38:28",
      "content": "<p><a href=\"https://www.kaggle.com/gtgnhqq\" target=\"_blank\">@gtgnhqq</a> I was able to find the core bug in your code:</p>\n<pre><code>row_ids = submission[].copy()\nsubmission_transformed = submission.groupby().transform()\nsubmission_transformed[] = row_ids\nsubmission = submission_transformed[[, , , ]]\n</code></pre>\n<p>It should be <code>submission = submission.groupby('row_id').mean().reset_index()</code></p>\n<h3>Reason:</h3>\n<p>If you see <code>transform</code> <a href=\"https://pandas.pydata.org/docs/reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html\" target=\"_blank\">documentation</a>:</p>\n<blockquote>\n  <p>Returns a DataFrame having the same indexes as the original object filled with the transformed values.</p>\n</blockquote>\n<p>This means that the duplicate <code>row_id</code> values are still present and <a href=\"https://www.kaggle.com/code/coderrkj/lumbar-competition-debugging-notebook?scriptVersionId=188924486\" target=\"_blank\">Version 2</a> of my modified copy of your original notebook caught that error by adding validation to the <code>merge</code> method: <code>submission = ordered_row_ids.merge(submission, how=\"left\", on=\"row_id\", validate=\"1:1\")</code></p>\n<h3>Additional points:</h3>\n<ul>\n<li><a href=\"https://www.kaggle.com/code/coderrkj/lumbar-competition-debugging-notebook?scriptVersionId=188947891\" target=\"_blank\">Version 3</a> shows how to predict over train images and get score from competition metric.</li>\n<li><a href=\"https://www.kaggle.com/code/coderrkj/lumbar-competition-debugging-notebook?scriptVersionId=188948027\" target=\"_blank\">Version 4</a>, I have disabled this evaluation and submitted it for testing with hidden data (LB: 1.02 with random weights).</li>\n<li>You can submit with <code>FAKE_TEST</code> as True or False as <code>and len(ss_df) &lt;= 25</code> will ensure hidden test case will be evaluated during submission.</li>\n<li>Remove comments on code with <code>## DEBUG</code> above them, when copying the code back to your notebook with trained weights.</li>\n</ul>",
      "votes": null,
      "replies": [
        {
          "id": 2929637,
          "author_name": "",
          "author_url": "",
          "post_date": "07/20/2024 08:26:00",
          "content": "<p>Thank you so much, I finally succeeded! After so many days, I'm really grateful.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2925229": "hye team,I'm facing a problem and have tried many solutions, but nothing is working. I really need help. someone expert help me to fix these :https://www.kaggle.com/code/gtgnhqq/lumbar-competition!\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F20802231%2Fb506973ba1c37713350fb3c66ccb6b2d%2FSnipaste_2024-07-17_10-57-06.png?generation=1721185127828848&alt=media)",
    "2925317": "gtgnhqq After checking all your codes are running properly, turn off the internet (Session options >> Internet \"Turn off\").\nTry to save your note book as a public file (share >> Public) \nAnd also Install the required Libraries \n# Install the required libraries\n!pip install pandas==2.2.2\n!pip install scikit-learn==1.2.2\n!pip install numpy==1.26.4\n\nFor more, check out my notebook, [Easy Essay Transformer LAL](https://www.kaggle.com/code/raja6242/easy-essay-transformer-lal)",
    "2925467": "I still haven’t resolved it, and I’ve run out of attempts for today.😭",
    "2925536": "In your code above,\n```python\nT1 = {\n    'Sagittal T2/STIR':['spinal_canal_stenosis_l1_l2', 'spinal_canal_stenosis_l2_l3', 'spinal_canal_stenosis_l3_l4',\n           'spinal_canal_stenosis_l4_l5', 'spinal_canal_stenosis_l5_s1'],\n    'Axial T2':['left_subarticular_stenosis_l1_l2', 'left_subarticular_stenosis_l2_l3', 'left_subarticular_stenosis_l3_l4',\n       'left_subarticular_stenosis_l4_l5', 'left_subarticular_stenosis_l5_s1', 'right_subarticular_stenosis_l1_l2',\n       'right_subarticular_stenosis_l2_l3', 'right_subarticular_stenosis_l3_l4', 'right_subarticular_stenosis_l4_l5',\n       'right_subarticular_stenosis_l5_s1'],\n    'Sagittal T1' : ['left_neural_foraminal_narrowing_l1_l2', 'left_neural_foraminal_narrowing_l2_l3', 'left_neural_foraminal_narrowing_l3_l4',\n       'left_neural_foraminal_narrowing_l4_l5', 'left_neural_foraminal_narrowing_l5_s1', 'right_neural_foraminal_narrowing_l1_l2',\n       'right_neural_foraminal_narrowing_l2_l3', 'right_neural_foraminal_narrowing_l3_l4', 'right_neural_foraminal_narrowing_l4_l5',\n       'right_neural_foraminal_narrowing_l5_s1'],\n}\n```\nThis mapping is a correct assumption. But the error occurs, I think, when there is missing `Sagittal T2/STIR` and `Sagittal T1` series (There are training study cases with is issue). This leads to missing `row_id` values in final submission.\n\nMy suggestion:\n- Read sample_submission.csv. Change the default value of `0.3333333333333333` if you want to.\n- Use `combine_first` method to fill missing `row_id` values.\n- As an example, in the last cell: \n```python\nss_df = pd.read_csv(\"/kaggle/input/rsna-2024-lumbar-spine-degenerative-classification/sample_submission.csv\")\nassert submission.row_id.isin(ss_df.row_id).all() # Check if all `row_id` values are valid (Optional)\nsubmission = submission.set_index(\"row_id\").combine_first(ss_df.set_index(\"row_id\")).reset_index()\nsubmission.to_csv('submission.csv', index=False)\n```",
    "2926785": "I still haven't succeeded, and this is my tenth attempt at submission.😭",
    "2926909": "I want to confirm that Version 8 is still getting \"Submission Scoring Error\" and not \"Notebook Threw Exception\".\n\nIf so, assert the following before `submission.to_csv('submission.csv', index=False)`:\n- Assert dtype for last 3 columns are of some float type (or do conversion)\n- Assert no NaN values exist in `submission`\n- Round the float values to 6 decimals (to prevent exponential notation [e.g.: 1.6e-8])",
    "2927119": "I still haven't succeeded, despite all my attempts. It's so difficult. I've been revising for five days, and I don't understand why I can only submit twice a day. Even failed submissions count towards the submission limit. I'm on the verge of breaking down!!!😭",
    "2927123": "![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F20802231%2F4a55df458f50c7fc27e52a44cd23b1bf%2FQQ20240718172125.png?generation=1721294547337732&alt=media)\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F20802231%2F22fb6e4fdb5a763aa7a0a4a1549e6fb4%2FQQ20240718172141.png?generation=1721294556443629&alt=media)\nIt still shows a submission scoring error.",
    "2927161": "Are you ensuring each row still sums to 1 after changing float format etc?",
    "2927168": "submission[['normal_mild', 'moderate', 'severe']] = submission[['normal_mild', 'moderate', 'severe']].div(submission[['normal_mild', 'moderate', 'severe']].sum(axis=1), axis=0)\nIs it okay if I write it like this?",
    "2927174": "Just to test if this is the issue, you could set the 3rd column to just be (1-column1-column2) to see if it works. I've had weird problems in that past with rounding, not sure if it's the issue here though",
    "2927402": "I still can't get it right; I'm about to collapse.",
    "2928625": "gtgnhqq I was able to find the core bug in your code:\n```python\nrow_ids = submission['row_id'].copy()\nsubmission_transformed = submission.groupby('row_id').transform('mean')\nsubmission_transformed['row_id'] = row_ids\nsubmission = submission_transformed[['row_id', 'normal_mild', 'moderate', 'severe']]\n```\nIt should be `submission = submission.groupby('row_id').mean().reset_index()`\n\n### Reason: \nIf you see `transform` [documentation](https://pandas.pydata.org/docs/reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html):\n> Returns a DataFrame having the same indexes as the original object filled with the transformed values.\n\nThis means that the duplicate `row_id` values are still present and [Version 2](https://www.kaggle.com/code/coderrkj/lumbar-competition-debugging-notebook?scriptVersionId=188924486) of my modified copy of your original notebook caught that error by adding validation to the `merge` method: `submission = ordered_row_ids.merge(submission, how=\"left\", on=\"row_id\", validate=\"1:1\")`\n\n### Additional points:\n-  [Version 3](https://www.kaggle.com/code/coderrkj/lumbar-competition-debugging-notebook?scriptVersionId=188947891) shows how to predict over train images and get score from competition metric.\n- [Version 4](https://www.kaggle.com/code/coderrkj/lumbar-competition-debugging-notebook?scriptVersionId=188948027), I have disabled this evaluation and submitted it for testing with hidden data (LB: 1.02 with random weights).\n- You can submit with `FAKE_TEST` as True or False as `and len(ss_df) <= 25` will ensure hidden test case will be evaluated during submission.\n- Remove comments on code with `## DEBUG` above them, when copying the code back to your notebook with trained weights.",
    "2929637": "Thank you so much, I finally succeeded! After so many days, I'm really grateful."
  },
  "source": "meta"
}