{
  "id": 397074,
  "title": "When will the api be fixed",
  "url": "/competitions/predict-student-performance-from-game-play/discussion/397074",
  "author_name": "",
  "post_date": "2023-03-24T00:53:40.207085400Z",
  "votes": 3,
  "comment_count": 7,
  "views": 0,
  "content": "<p>When I run the inference code, I found that iter_test will give three level groups at a time, and from the discussion <a href=\"https://www.kaggle.com/competitions/predict-student-performance-from-game-play/discussion/396202#2191405\" target=\"_blank\">here</a> I learned that the API is not fixed, resulting error in submission. May I know when will it be fixed?</p>",
  "messages": [
    {
      "id": "2194484",
      "postDate": "03/24/2023 00:53:40",
      "content": "<p>When I run the inference code, I found that iter_test will give three level groups at a time, and from the discussion <a href=\"https://www.kaggle.com/competitions/predict-student-performance-from-game-play/discussion/396202#2191405\" target=\"_blank\">here</a> I learned that the API is not fixed, resulting error in submission. May I know when will it be fixed?</p>",
      "rawMarkdown": "When I run the inference code, I found that iter_test will give three level groups at a time, and from the discussion [here](https://www.kaggle.com/competitions/predict-student-performance-from-game-play/discussion/396202#2191405) I learned that the API is not fixed, resulting error in submission. May I know when will it be fixed?",
      "votes": null
    },
    {
      "id": "2194485",
      "postDate": "03/24/2023 00:55:16",
      "content": "<p>The error is: ValueError: can only convert an array of size 1 to a Python scalar</p>",
      "rawMarkdown": "The error is: ValueError: can only convert an array of size 1 to a Python scalar",
      "votes": null
    },
    {
      "id": "2194693",
      "postDate": "03/24/2023 05:15:31",
      "content": "<p>Change <code>p.item()</code> to <code>p[0]</code> then both your commit and submit will work.</p>",
      "rawMarkdown": "Change `p.item()` to `p[0]` then both your commit and submit will work.",
      "votes": null
    },
    {
      "id": "2194767",
      "postDate": "03/24/2023 06:29:33",
      "content": "<p>Thank you Chris! When I modified my code, it committed successfully, however, when I submitted the code, it failed, and I cannot see where is the error. <br>\nThe prediction code is like this:<br>\np = clf.predict_proba(df[FEATURES].astype(np.float32))[:,1].item()<br>\nthen I changed it to <br>\np = clf.predict_proba(df[FEATURES].astype(np.float32))[:,1][0]</p>",
      "rawMarkdown": "Thank you Chris! When I modified my code, it committed successfully, however, when I submitted the code, it failed, and I cannot see where is the error. \nThe prediction code is like this:\np = clf.predict_proba(df[FEATURES].astype(np.float32))[:,1].item()\nthen I changed it to \np = clf.predict_proba(df[FEATURES].astype(np.float32))[:,1][0]",
      "votes": null
    },
    {
      "id": "2194783",
      "postDate": "03/24/2023 06:40:30",
      "content": "<p>Did this exact same code without the change <code>p.item()</code> to <code>p[0]</code> submit successfully before? </p>\n<p>Did you also change <code>for (sample_submission, test) in iter_test:</code> to <code>for (test, sample_submission) in iter_test:</code>?</p>",
      "rawMarkdown": "Did this exact same code without the change `p.item()` to `p[0]` submit successfully before? \n\nDid you also change `for (sample_submission, test) in iter_test:` to `for (test, sample_submission) in iter_test:`?",
      "votes": null
    },
    {
      "id": "2194796",
      "postDate": "03/24/2023 06:50:42",
      "content": "<p>Yes, I did<br>\nDo you mean that what I only need to do, is to change from (test, sample_submission) to (sample_submission, test) and the p.item()?</p>",
      "rawMarkdown": "Yes, I did\nDo you mean that what I only need to do, is to change from (test, sample_submission) to (sample_submission, test) and the p.item()?",
      "votes": null
    },
    {
      "id": "2195226",
      "postDate": "03/24/2023 14:03:32",
      "content": "<p>Those are the only 2 changes needed to fix most public notebooks. And of course the new train data is larger now, so we also need to update code to avoid memory error during feature engineering and training.</p>\n<p>Note the correct order is now <code>(test, sample_submission)</code>. The old order was <code>(sample_submission, test)</code>. You can find an example in my updated XGB baseline <a href=\"https://www.kaggle.com/code/cdeotte/xgboost-baseline-0-680\" target=\"_blank\">here</a>. Version 3 works on the new data. And versions 2 and 1 work on the old data.</p>",
      "rawMarkdown": "Those are the only 2 changes needed to fix most public notebooks. And of course the new train data is larger now, so we also need to update code to avoid memory error during feature engineering and training.\n\nNote the correct order is now `(test, sample_submission)`. The old order was `(sample_submission, test)`. You can find an example in my updated XGB baseline [here][1]. Version 3 works on the new data. And versions 2 and 1 work on the old data.\n\n[1]: https://www.kaggle.com/code/cdeotte/xgboost-baseline-0-680",
      "votes": null
    },
    {
      "id": "2196038",
      "postDate": "03/25/2023 05:30:34",
      "content": "<p>Thank you! Now it worked, I found that's all what I need to do. </p>",
      "rawMarkdown": "Thank you! Now it worked, I found that's all what I need to do.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2194485,
      "author_name": "harrisonliang",
      "author_url": "",
      "post_date": "03/24/2023 00:55:16",
      "content": "<p>The error is: ValueError: can only convert an array of size 1 to a Python scalar</p>",
      "votes": null,
      "replies": [
        {
          "id": 2194693,
          "author_name": "cdeotte",
          "author_url": "",
          "post_date": "03/24/2023 05:15:31",
          "content": "<p>Change <code>p.item()</code> to <code>p[0]</code> then both your commit and submit will work.</p>",
          "votes": null,
          "replies": [
            {
              "id": 2194767,
              "author_name": "harrisonliang",
              "author_url": "",
              "post_date": "03/24/2023 06:29:33",
              "content": "<p>Thank you Chris! When I modified my code, it committed successfully, however, when I submitted the code, it failed, and I cannot see where is the error. <br>\nThe prediction code is like this:<br>\np = clf.predict_proba(df[FEATURES].astype(np.float32))[:,1].item()<br>\nthen I changed it to <br>\np = clf.predict_proba(df[FEATURES].astype(np.float32))[:,1][0]</p>",
              "votes": null,
              "replies": [
                {
                  "id": 2194783,
                  "author_name": "cdeotte",
                  "author_url": "",
                  "post_date": "03/24/2023 06:40:30",
                  "content": "<p>Did this exact same code without the change <code>p.item()</code> to <code>p[0]</code> submit successfully before? </p>\n<p>Did you also change <code>for (sample_submission, test) in iter_test:</code> to <code>for (test, sample_submission) in iter_test:</code>?</p>",
                  "votes": null,
                  "replies": [
                    {
                      "id": 2194796,
                      "author_name": "harrisonliang",
                      "author_url": "",
                      "post_date": "03/24/2023 06:50:42",
                      "content": "<p>Yes, I did<br>\nDo you mean that what I only need to do, is to change from (test, sample_submission) to (sample_submission, test) and the p.item()?</p>",
                      "votes": null,
                      "replies": [
                        {
                          "id": 2195226,
                          "author_name": "cdeotte",
                          "author_url": "",
                          "post_date": "03/24/2023 14:03:32",
                          "content": "<p>Those are the only 2 changes needed to fix most public notebooks. And of course the new train data is larger now, so we also need to update code to avoid memory error during feature engineering and training.</p>\n<p>Note the correct order is now <code>(test, sample_submission)</code>. The old order was <code>(sample_submission, test)</code>. You can find an example in my updated XGB baseline <a href=\"https://www.kaggle.com/code/cdeotte/xgboost-baseline-0-680\" target=\"_blank\">here</a>. Version 3 works on the new data. And versions 2 and 1 work on the old data.</p>",
                          "votes": null,
                          "replies": [
                            {
                              "id": 2196038,
                              "author_name": "harrisonliang",
                              "author_url": "",
                              "post_date": "03/25/2023 05:30:34",
                              "content": "<p>Thank you! Now it worked, I found that's all what I need to do. </p>",
                              "votes": null,
                              "replies": []
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2194484": "When I run the inference code, I found that iter_test will give three level groups at a time, and from the discussion [here](https://www.kaggle.com/competitions/predict-student-performance-from-game-play/discussion/396202#2191405) I learned that the API is not fixed, resulting error in submission. May I know when will it be fixed?",
    "2194485": "The error is: ValueError: can only convert an array of size 1 to a Python scalar",
    "2194693": "Change `p.item()` to `p[0]` then both your commit and submit will work.",
    "2194767": "Thank you Chris! When I modified my code, it committed successfully, however, when I submitted the code, it failed, and I cannot see where is the error. \nThe prediction code is like this:\np = clf.predict_proba(df[FEATURES].astype(np.float32))[:,1].item()\nthen I changed it to \np = clf.predict_proba(df[FEATURES].astype(np.float32))[:,1][0]",
    "2194783": "Did this exact same code without the change `p.item()` to `p[0]` submit successfully before? \n\nDid you also change `for (sample_submission, test) in iter_test:` to `for (test, sample_submission) in iter_test:`?",
    "2194796": "Yes, I did\nDo you mean that what I only need to do, is to change from (test, sample_submission) to (sample_submission, test) and the p.item()?",
    "2195226": "Those are the only 2 changes needed to fix most public notebooks. And of course the new train data is larger now, so we also need to update code to avoid memory error during feature engineering and training.\n\nNote the correct order is now `(test, sample_submission)`. The old order was `(sample_submission, test)`. You can find an example in my updated XGB baseline [here][1]. Version 3 works on the new data. And versions 2 and 1 work on the old data.\n\n[1]: https://www.kaggle.com/code/cdeotte/xgboost-baseline-0-680",
    "2196038": "Thank you! Now it worked, I found that's all what I need to do."
  },
  "source": "meta"
}