{
  "id": 583504,
  "title": "Making a submission using the API",
  "url": "/competitions/cmi-detect-behavior-with-sensor-data/discussion/583504",
  "author_name": "",
  "post_date": "2025-06-07T10:58:48.271249Z",
  "votes": 1,
  "comment_count": 3,
  "views": 0,
  "content": "<p>I'm just trying to understand the procedure for making a submission in this competition (which is quite different to anything else I've done here on kaggle):</p>\n<p>The code to access the API is in the <a href=\"https://www.kaggle.com/code/sohier/cmi-2025-demo-submission\" target=\"_blank\">Demo Submission Notebook</a>. </p>\n<p>My understanding is that the predict function that we need to fill out takes one sequence at a time (i.e. one sequence_id, and hence one subject_id at a time). So, the dataframe that we need to process will look similar to that from test.csv. </p>\n<p>And from each sequence processed (i.e. each test.csv-like dataframe) we get one gesture class prediction so the predict function returns one string.</p>\n<p>Is that right?</p>",
  "messages": [
    {
      "id": "3219236",
      "postDate": "06/07/2025 10:58:48",
      "content": "<p>I'm just trying to understand the procedure for making a submission in this competition (which is quite different to anything else I've done here on kaggle):</p>\n<p>The code to access the API is in the <a href=\"https://www.kaggle.com/code/sohier/cmi-2025-demo-submission\" target=\"_blank\">Demo Submission Notebook</a>. </p>\n<p>My understanding is that the predict function that we need to fill out takes one sequence at a time (i.e. one sequence_id, and hence one subject_id at a time). So, the dataframe that we need to process will look similar to that from test.csv. </p>\n<p>And from each sequence processed (i.e. each test.csv-like dataframe) we get one gesture class prediction so the predict function returns one string.</p>\n<p>Is that right?</p>",
      "rawMarkdown": "I'm just trying to understand the procedure for making a submission in this competition (which is quite different to anything else I've done here on kaggle):\n\nThe code to access the API is in the [Demo Submission Notebook](https://www.kaggle.com/code/sohier/cmi-2025-demo-submission). \n\nMy understanding is that the predict function that we need to fill out takes one sequence at a time (i.e. one sequence_id, and hence one subject_id at a time). So, the dataframe that we need to process will look similar to that from test.csv. \n\nAnd from each sequence processed (i.e. each test.csv-like dataframe) we get one gesture class prediction so the predict function returns one string.\n\nIs that right?",
      "votes": null
    },
    {
      "id": "3219270",
      "postDate": "06/07/2025 11:53:41",
      "content": "<p>You are required to implement the predict function to handle a specific type of input: a single sequence and demographics_demo. The function should output a single gesture prediction corresponding to that sequence.</p>",
      "rawMarkdown": "You are required to implement the predict function to handle a specific type of input: a single sequence and demographics_demo. The function should output a single gesture prediction corresponding to that sequence.",
      "votes": null
    },
    {
      "id": "3219809",
      "postDate": "06/08/2025 10:41:38",
      "content": "<p>Thanks shanzhong8.</p>",
      "rawMarkdown": "Thanks shanzhong8.",
      "votes": null
    },
    {
      "id": "3219814",
      "postDate": "06/08/2025 10:50:34",
      "content": "<p>I successfully managed to make some predictions! As shanzhong8 points out, the predict function takes a single sequence and the associated demographics data (which I didn't use yet). The data passed in will be like the test.csv set but just for one sequence_id. The sample test.csv provided as input has two sequence_ids, so you can mimic the input into predict() by splitting the test.csv data file into two sequences. Column names/types in the data served up by the API will be the same as test.csv.</p>\n<p>Here are some tips that might help others who are struggling with the submission API:</p>\n<p>Even though the documentation in the <a href=\"https://www.kaggle.com/code/sohier/cmi-2025-demo-submission/\" target=\"_blank\">Demo Submission Notebook</a> says that the predict function can accept polars or pandas, I had problems with using pandas dataframes as somewhere along the line my pandas got converted into a polars dataframe. So it was easier to change my data processing workflow to use polars dataframes in the first instance.</p>\n<p>The function return value should be a single string (i.e. the classified gesture). I kept getting <code>&lt;GatewayRuntimeErrorType.SERVER_RAISED_EXCEPTION: 3&gt;</code> and this was because my function was returning a <code>np.str_</code> value, which, although it looks similar enough, is different enough from a base python <code>str</code> to cause problems.</p>",
      "rawMarkdown": "I successfully managed to make some predictions! As shanzhong8 points out, the predict function takes a single sequence and the associated demographics data (which I didn't use yet). The data passed in will be like the test.csv set but just for one sequence_id. The sample test.csv provided as input has two sequence_ids, so you can mimic the input into predict() by splitting the test.csv data file into two sequences. Column names/types in the data served up by the API will be the same as test.csv.\n\nHere are some tips that might help others who are struggling with the submission API:\n\nEven though the documentation in the [Demo Submission Notebook](https://www.kaggle.com/code/sohier/cmi-2025-demo-submission/) says that the predict function can accept polars or pandas, I had problems with using pandas dataframes as somewhere along the line my pandas got converted into a polars dataframe. So it was easier to change my data processing workflow to use polars dataframes in the first instance.\n\nThe function return value should be a single string (i.e. the classified gesture). I kept getting `<GatewayRuntimeErrorType.SERVER_RAISED_EXCEPTION: 3>` and this was because my function was returning a `np.str_` value, which, although it looks similar enough, is different enough from a base python `str` to cause problems.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 3219270,
      "author_name": "shanzhong8",
      "author_url": "",
      "post_date": "06/07/2025 11:53:41",
      "content": "<p>You are required to implement the predict function to handle a specific type of input: a single sequence and demographics_demo. The function should output a single gesture prediction corresponding to that sequence.</p>",
      "votes": null,
      "replies": [
        {
          "id": 3219809,
          "author_name": "nnjjpp",
          "author_url": "",
          "post_date": "06/08/2025 10:41:38",
          "content": "<p>Thanks shanzhong8.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 3219814,
      "author_name": "nnjjpp",
      "author_url": "",
      "post_date": "06/08/2025 10:50:34",
      "content": "<p>I successfully managed to make some predictions! As shanzhong8 points out, the predict function takes a single sequence and the associated demographics data (which I didn't use yet). The data passed in will be like the test.csv set but just for one sequence_id. The sample test.csv provided as input has two sequence_ids, so you can mimic the input into predict() by splitting the test.csv data file into two sequences. Column names/types in the data served up by the API will be the same as test.csv.</p>\n<p>Here are some tips that might help others who are struggling with the submission API:</p>\n<p>Even though the documentation in the <a href=\"https://www.kaggle.com/code/sohier/cmi-2025-demo-submission/\" target=\"_blank\">Demo Submission Notebook</a> says that the predict function can accept polars or pandas, I had problems with using pandas dataframes as somewhere along the line my pandas got converted into a polars dataframe. So it was easier to change my data processing workflow to use polars dataframes in the first instance.</p>\n<p>The function return value should be a single string (i.e. the classified gesture). I kept getting <code>&lt;GatewayRuntimeErrorType.SERVER_RAISED_EXCEPTION: 3&gt;</code> and this was because my function was returning a <code>np.str_</code> value, which, although it looks similar enough, is different enough from a base python <code>str</code> to cause problems.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "3219236": "I'm just trying to understand the procedure for making a submission in this competition (which is quite different to anything else I've done here on kaggle):\n\nThe code to access the API is in the [Demo Submission Notebook](https://www.kaggle.com/code/sohier/cmi-2025-demo-submission). \n\nMy understanding is that the predict function that we need to fill out takes one sequence at a time (i.e. one sequence_id, and hence one subject_id at a time). So, the dataframe that we need to process will look similar to that from test.csv. \n\nAnd from each sequence processed (i.e. each test.csv-like dataframe) we get one gesture class prediction so the predict function returns one string.\n\nIs that right?",
    "3219270": "You are required to implement the predict function to handle a specific type of input: a single sequence and demographics_demo. The function should output a single gesture prediction corresponding to that sequence.",
    "3219809": "Thanks shanzhong8.",
    "3219814": "I successfully managed to make some predictions! As shanzhong8 points out, the predict function takes a single sequence and the associated demographics data (which I didn't use yet). The data passed in will be like the test.csv set but just for one sequence_id. The sample test.csv provided as input has two sequence_ids, so you can mimic the input into predict() by splitting the test.csv data file into two sequences. Column names/types in the data served up by the API will be the same as test.csv.\n\nHere are some tips that might help others who are struggling with the submission API:\n\nEven though the documentation in the [Demo Submission Notebook](https://www.kaggle.com/code/sohier/cmi-2025-demo-submission/) says that the predict function can accept polars or pandas, I had problems with using pandas dataframes as somewhere along the line my pandas got converted into a polars dataframe. So it was easier to change my data processing workflow to use polars dataframes in the first instance.\n\nThe function return value should be a single string (i.e. the classified gesture). I kept getting `<GatewayRuntimeErrorType.SERVER_RAISED_EXCEPTION: 3>` and this was because my function was returning a `np.str_` value, which, although it looks similar enough, is different enough from a base python `str` to cause problems."
  },
  "source": "meta"
}