{
  "id": 399165,
  "title": "Where is the sample notebook referred to in the `Data` tab?",
  "url": "/competitions/predict-student-performance-from-game-play/discussion/399165",
  "author_name": "calvdee",
  "post_date": "2023-04-02T20:03:12.058000",
  "votes": 2,
  "comment_count": 7,
  "views": 0,
  "content": "<p>In the <code>Data</code> tab, it says </p>\n<blockquote>\n  <p>use the sample notebook to iterate over the test data</p>\n</blockquote>\n<p>Where do I find this sample notebook?</p>",
  "messages": [
    {
      "id": 2206766,
      "postDate": "2023-04-02T20:20:48.387Z",
      "content": "<p>I also didn't find mentioned notebook. But I guess Infer test data part of <a href=\"https://www.kaggle.com/code/cdeotte/xgboost-baseline-0-680\" target=\"_blank\">this notebook</a> would work for you.</p>",
      "rawMarkdown": "I also didn't find mentioned notebook. But I guess Infer test data part of [this notebook](https://www.kaggle.com/code/cdeotte/xgboost-baseline-0-680) would work for you.",
      "votes": 1,
      "replies": [
        {
          "id": 2206776,
          "postDate": "2023-04-02T20:38:45.013Z",
          "content": "<p>Thanks! Will check it out after doing some of my own EDA :)</p>",
          "rawMarkdown": "Thanks! Will check it out after doing some of my own EDA :)"
        },
        {
          "id": 2206803,
          "postDate": "2023-04-02T21:28:17.700Z",
          "content": "<p>I don't understand what this does:</p>\n<pre><code># IMPORT KAGGLE API\nimport jo_wilder\nenv = jo_wilder.make_env()\niter_test = env.iter_test()\n</code></pre>\n<p>The <code>__init__.py</code> file just contains:</p>\n<pre><code>from .competition import make_env\n\n__all__ = ['make_env']\n</code></pre>\n<p>There is no <code>competition</code> module. </p>\n<p>Do you know how I should be running this?</p>",
          "rawMarkdown": "I don't understand what this does:\n\n```\n# IMPORT KAGGLE API\nimport jo_wilder\nenv = jo_wilder.make_env()\niter_test = env.iter_test()\n```\n\nThe `__init__.py` file just contains:\n\n```\nfrom .competition import make_env\n\n__all__ = ['make_env']\n```\n\nThere is no `competition` module. \n\nDo you know how I should be running this?",
          "replies": [
            {
              "id": 2207089,
              "postDate": "2023-04-03T05:30:43.550Z",
              "content": "<p>It connects to Kaggle API, you should run it as-is. No need to check <strong>init</strong>.py. Once you run it, next code to run is:</p>\n<pre><code> (test, sample_submission)  iter_test:\n    sample_submission[] = [(label.split()[][:])  label  sample_submission[]]\n\n    \n    df = feature_engineer(test)\n\n    \n    grp = test.level_group.values[]\n    a,b = limits[grp]\n     t  (a,b):\n        clf = models[]\n        p = clf.predict_proba(df[FEATURES].astype())[:,]\n        mask = sample_submission.question == t    \n        sample_submission.loc[mask, ] = (p &gt; best_threshold).astype() \n    env.predict(sample_submission[[, ]])\n</code></pre>\n<p>Basically, this code gives you access to one level group at a time from test data and you can give predictions only here.</p>",
              "rawMarkdown": "It connects to Kaggle API, you should run it as-is. No need to check __init__.py. Once you run it, next code to run is:\n\n\n```python\nfor (test, sample_submission) in iter_test:\n    sample_submission['question'] = [int(label.split('_')[1][1:]) for label in sample_submission['session_id']]\n\n    # Your function to transform test data\n    df = feature_engineer(test)\n    \n    # INFER TEST DATA\n    grp = test.level_group.values[0]\n    a,b = limits[grp]\n    for t in range(a,b):\n        clf = models[f'{grp}_{t}']\n        p = clf.predict_proba(df[FEATURES].astype('float32'))[:,1]\n        mask = sample_submission.question == t    \n        sample_submission.loc[mask, 'correct'] = (p > best_threshold).astype('int') \n    env.predict(sample_submission[['session_id', 'correct']])\n```\n\nBasically, this code gives you access to one level group at a time from test data and you can give predictions only here.\n\n"
            },
            {
              "id": 2209814,
              "postDate": "2023-04-04T23:52:34.860Z",
              "rawMarkdown": "",
              "isDeleted": true
            }
          ]
        }
      ]
    },
    {
      "id": 2206755,
      "postDate": "2023-04-02T20:03:12.060Z",
      "content": "<p>In the <code>Data</code> tab, it says </p>\n<blockquote>\n  <p>use the sample notebook to iterate over the test data</p>\n</blockquote>\n<p>Where do I find this sample notebook?</p>",
      "rawMarkdown": "In the `Data` tab, it says \n\n> use the sample notebook to iterate over the test data\n\nWhere do I find this sample notebook?",
      "votes": 1
    },
    {
      "id": 2208523,
      "postDate": "2023-04-04T06:03:31.337Z",
      "content": "<p>The official sample notebook is <a href=\"https://www.kaggle.com/code/philculliton/basic-submission-demo\" target=\"_blank\">here</a>, but it doesn't work anymore because Kaggle updated the API and now the API returns <code>for (test, sample_submission) in iter_test:</code> instead of <code>for (sample_submission, test) in iter_test:</code> so Elshan Kazim suggestion of using my notebook is a good one because my notebook works with the new API</p>",
      "rawMarkdown": "The official sample notebook is [here][1], but it doesn't work anymore because Kaggle updated the API and now the API returns `for (test, sample_submission) in iter_test:` instead of `for (sample_submission, test) in iter_test:` so Elshan Kazim suggestion of using my notebook is a good one because my notebook works with the new API\n\n[1]: https://www.kaggle.com/code/philculliton/basic-submission-demo",
      "replies": [
        {
          "id": 2209816,
          "postDate": "2023-04-04T23:56:18.537Z",
          "content": "<p>Thanks for putting the notebook together. I haven't participated in a comp in a while…Sounds like the only way to make predictions then is using Kaggle hosted notebooks (vs doing it say locally or in another hosted environment)?</p>",
          "rawMarkdown": "Thanks for putting the notebook together. I haven't participated in a comp in a while...Sounds like the only way to make predictions then is using Kaggle hosted notebooks (vs doing it say locally or in another hosted environment)?"
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 2206766,
      "author_name": "Elshan Kazim",
      "author_url": "",
      "post_date": "2023-04-02T20:20:48.387000",
      "content": "<p>I also didn't find mentioned notebook. But I guess Infer test data part of <a href=\"https://www.kaggle.com/code/cdeotte/xgboost-baseline-0-680\" target=\"_blank\">this notebook</a> would work for you.</p>",
      "votes": 1,
      "replies": [
        {
          "id": 2206776,
          "author_name": "calvdee",
          "author_url": "",
          "post_date": "2023-04-02T20:38:45.013000",
          "content": "<p>Thanks! Will check it out after doing some of my own EDA :)</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 2206803,
          "author_name": "calvdee",
          "author_url": "",
          "post_date": "2023-04-02T21:28:17.700000",
          "content": "<p>I don't understand what this does:</p>\n<pre><code># IMPORT KAGGLE API\nimport jo_wilder\nenv = jo_wilder.make_env()\niter_test = env.iter_test()\n</code></pre>\n<p>The <code>__init__.py</code> file just contains:</p>\n<pre><code>from .competition import make_env\n\n__all__ = ['make_env']\n</code></pre>\n<p>There is no <code>competition</code> module. </p>\n<p>Do you know how I should be running this?</p>",
          "votes": 0,
          "replies": [
            {
              "id": 2207089,
              "author_name": "Elshan Kazim",
              "author_url": "",
              "post_date": "2023-04-03T05:30:43.550000",
              "content": "<p>It connects to Kaggle API, you should run it as-is. No need to check <strong>init</strong>.py. Once you run it, next code to run is:</p>\n<pre><code> (test, sample_submission)  iter_test:\n    sample_submission[] = [(label.split()[][:])  label  sample_submission[]]\n\n    \n    df = feature_engineer(test)\n\n    \n    grp = test.level_group.values[]\n    a,b = limits[grp]\n     t  (a,b):\n        clf = models[]\n        p = clf.predict_proba(df[FEATURES].astype())[:,]\n        mask = sample_submission.question == t    \n        sample_submission.loc[mask, ] = (p &gt; best_threshold).astype() \n    env.predict(sample_submission[[, ]])\n</code></pre>\n<p>Basically, this code gives you access to one level group at a time from test data and you can give predictions only here.</p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2209814,
              "author_name": "",
              "author_url": "",
              "post_date": "2023-04-04T23:52:34.860000",
              "content": "",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2208523,
      "author_name": "Chris Deotte",
      "author_url": "",
      "post_date": "2023-04-04T06:03:31.337000",
      "content": "<p>The official sample notebook is <a href=\"https://www.kaggle.com/code/philculliton/basic-submission-demo\" target=\"_blank\">here</a>, but it doesn't work anymore because Kaggle updated the API and now the API returns <code>for (test, sample_submission) in iter_test:</code> instead of <code>for (sample_submission, test) in iter_test:</code> so Elshan Kazim suggestion of using my notebook is a good one because my notebook works with the new API</p>",
      "votes": 0,
      "replies": [
        {
          "id": 2209816,
          "author_name": "calvdee",
          "author_url": "",
          "post_date": "2023-04-04T23:56:18.537000",
          "content": "<p>Thanks for putting the notebook together. I haven't participated in a comp in a while…Sounds like the only way to make predictions then is using Kaggle hosted notebooks (vs doing it say locally or in another hosted environment)?</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2206766": "I also didn't find mentioned notebook. But I guess Infer test data part of [this notebook](https://www.kaggle.com/code/cdeotte/xgboost-baseline-0-680) would work for you.",
    "2206755": "In the `Data` tab, it says \n\n> use the sample notebook to iterate over the test data\n\nWhere do I find this sample notebook?",
    "2208523": "The official sample notebook is [here][1], but it doesn't work anymore because Kaggle updated the API and now the API returns `for (test, sample_submission) in iter_test:` instead of `for (sample_submission, test) in iter_test:` so Elshan Kazim suggestion of using my notebook is a good one because my notebook works with the new API\n\n[1]: https://www.kaggle.com/code/philculliton/basic-submission-demo"
  }
}