{
  "id": 177722,
  "title": "Can directly load csv and submit?",
  "url": "/competitions/osic-pulmonary-fibrosis-progression/discussion/177722",
  "author_name": "",
  "post_date": "2020-08-27T04:20:38.559699600Z",
  "votes": null,
  "comment_count": 3,
  "views": 0,
  "content": "<p>Hi, </p>\n<p>I am new to the Kaggle competition and kinda confused about the \"code competition\".</p>\n<p>I saw that it is allowed to train the model locally and upload the weights as an external dataset, then load the model with pretrained weights and do the inference on the test dataset in the notebook and submit.</p>\n<p>However, I would like to know if it is possible that I train the model and do the inference on my local machine, then save the results in the correct format in a submission.csv file, and upload the submission.csv file as an external dataset. Then in the Kaggle notebook I just need to do two things:</p>\n<p><code>\ndf = pd.read_csv('../input/submissions/submission.csv')\ndf.to_csv('/kaggle/working/submission.csv', index=False)\n</code><br>\nThen save&amp;run all and submit the result. </p>\n<p>I already did such things and it had no error when I do \"save&amp;rull all\" but when I submit, I got some error:<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F4393905%2F8a1e074355c963ff62f669a086276d41%2FScreenshot%20from%202020-08-27%2000-18-56.png?generation=1598501992183415&amp;alt=media\" alt=\"\"></p>\n<p>Anyone can help? Thanks!!!</p>",
  "messages": [
    {
      "id": "987170",
      "postDate": "08/27/2020 04:20:38",
      "content": "<p>Hi, </p>\n<p>I am new to the Kaggle competition and kinda confused about the \"code competition\".</p>\n<p>I saw that it is allowed to train the model locally and upload the weights as an external dataset, then load the model with pretrained weights and do the inference on the test dataset in the notebook and submit.</p>\n<p>However, I would like to know if it is possible that I train the model and do the inference on my local machine, then save the results in the correct format in a submission.csv file, and upload the submission.csv file as an external dataset. Then in the Kaggle notebook I just need to do two things:</p>\n<p><code>\ndf = pd.read_csv('../input/submissions/submission.csv')\ndf.to_csv('/kaggle/working/submission.csv', index=False)\n</code><br>\nThen save&amp;run all and submit the result. </p>\n<p>I already did such things and it had no error when I do \"save&amp;rull all\" but when I submit, I got some error:<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F4393905%2F8a1e074355c963ff62f669a086276d41%2FScreenshot%20from%202020-08-27%2000-18-56.png?generation=1598501992183415&amp;alt=media\" alt=\"\"></p>\n<p>Anyone can help? Thanks!!!</p>",
      "rawMarkdown": "Hi, \n\nI am new to the Kaggle competition and kinda confused about the \"code competition\".\n\nI saw that it is allowed to train the model locally and upload the weights as an external dataset, then load the model with pretrained weights and do the inference on the test dataset in the notebook and submit.\n\nHowever, I would like to know if it is possible that I train the model and do the inference on my local machine, then save the results in the correct format in a submission.csv file, and upload the submission.csv file as an external dataset. Then in the Kaggle notebook I just need to do two things:\n\n`\ndf = pd.read_csv('../input/submissions/submission.csv')\ndf.to_csv('/kaggle/working/submission.csv', index=False)\n`\nThen save&run all and submit the result. \n\nI already did such things and it had no error when I do \"save&rull all\" but when I submit, I got some error:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F4393905%2F8a1e074355c963ff62f669a086276d41%2FScreenshot%20from%202020-08-27%2000-18-56.png?generation=1598501992183415&alt=media)\n\n\nAnyone can help? Thanks!!!",
      "votes": null
    },
    {
      "id": "987185",
      "postDate": "08/27/2020 04:35:56",
      "content": "<p>It won't work because your code is rerun with the private dataset which will have more than 5 patients. So your submission.csv is supposed to have more than 5 patients' data in it. but doing it your way will only include the 5 patients in the public test set and none from the private one. So, kaggle gives you an error.</p>",
      "rawMarkdown": "It won't work because your code is rerun with the private dataset which will have more than 5 patients. So your submission.csv is supposed to have more than 5 patients' data in it. but doing it your way will only include the 5 patients in the public test set and none from the private one. So, kaggle gives you an error.",
      "votes": null
    },
    {
      "id": "987197",
      "postDate": "08/27/2020 04:45:27",
      "content": "<p>I see. I just got a similar answer when searching online, which says another test dataset would be applied. So in any \"code competition\", the inference code has to be run again in the Kaggle kernel? </p>",
      "rawMarkdown": "I see. I just got a similar answer when searching online, which says another test dataset would be applied. So in any \"code competition\", the inference code has to be run again in the Kaggle kernel?",
      "votes": null
    },
    {
      "id": "987720",
      "postDate": "08/27/2020 13:18:34",
      "content": "<p>Yeah you're right. </p>",
      "rawMarkdown": "Yeah you're right.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 987185,
      "author_name": "jonykarki",
      "author_url": "",
      "post_date": "08/27/2020 04:35:56",
      "content": "<p>It won't work because your code is rerun with the private dataset which will have more than 5 patients. So your submission.csv is supposed to have more than 5 patients' data in it. but doing it your way will only include the 5 patients in the public test set and none from the private one. So, kaggle gives you an error.</p>",
      "votes": null,
      "replies": [
        {
          "id": 987197,
          "author_name": "skyleov",
          "author_url": "",
          "post_date": "08/27/2020 04:45:27",
          "content": "<p>I see. I just got a similar answer when searching online, which says another test dataset would be applied. So in any \"code competition\", the inference code has to be run again in the Kaggle kernel? </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 987720,
          "author_name": "jonykarki",
          "author_url": "",
          "post_date": "08/27/2020 13:18:34",
          "content": "<p>Yeah you're right. </p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "987170": "Hi, \n\nI am new to the Kaggle competition and kinda confused about the \"code competition\".\n\nI saw that it is allowed to train the model locally and upload the weights as an external dataset, then load the model with pretrained weights and do the inference on the test dataset in the notebook and submit.\n\nHowever, I would like to know if it is possible that I train the model and do the inference on my local machine, then save the results in the correct format in a submission.csv file, and upload the submission.csv file as an external dataset. Then in the Kaggle notebook I just need to do two things:\n\n`\ndf = pd.read_csv('../input/submissions/submission.csv')\ndf.to_csv('/kaggle/working/submission.csv', index=False)\n`\nThen save&run all and submit the result. \n\nI already did such things and it had no error when I do \"save&rull all\" but when I submit, I got some error:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F4393905%2F8a1e074355c963ff62f669a086276d41%2FScreenshot%20from%202020-08-27%2000-18-56.png?generation=1598501992183415&alt=media)\n\n\nAnyone can help? Thanks!!!",
    "987185": "It won't work because your code is rerun with the private dataset which will have more than 5 patients. So your submission.csv is supposed to have more than 5 patients' data in it. but doing it your way will only include the 5 patients in the public test set and none from the private one. So, kaggle gives you an error.",
    "987197": "I see. I just got a similar answer when searching online, which says another test dataset would be applied. So in any \"code competition\", the inference code has to be run again in the Kaggle kernel?",
    "987720": "Yeah you're right."
  },
  "source": "meta"
}