{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"I am challenging this competition. This is my first time and I didn't know how to submit a submission, so I want to submit one, but for some reason I can't. Do you know why?","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-04-29T01:46:10.942078Z","iopub.execute_input":"2023-04-29T01:46:10.942434Z","iopub.status.idle":"2023-04-29T01:46:10.950390Z","shell.execute_reply.started":"2023-04-29T01:46:10.942401Z","shell.execute_reply":"2023-04-29T01:46:10.949031Z"}}},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd","metadata":{"execution":{"iopub.status.busy":"2023-05-01T12:23:21.801692Z","iopub.execute_input":"2023-05-01T12:23:21.802112Z","iopub.status.idle":"2023-05-01T12:23:21.806935Z","shell.execute_reply.started":"2023-05-01T12:23:21.802062Z","shell.execute_reply":"2023-05-01T12:23:21.806012Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_labels = pd.read_csv('/kaggle/input/predict-student-performance-from-game-play/train_labels.csv')\ntrain_labels['session'] = train_labels.session_id.apply(lambda x:int(x.split('_')[0]))\n#マイナス一で後ろから１行目\ntrain_labels['question'] = train_labels.session_id.apply(lambda x: int(x.split('_')[-1][1:]))\ntrain_labels.head(10)","metadata":{"execution":{"iopub.status.busy":"2023-05-01T12:23:23.219526Z","iopub.execute_input":"2023-05-01T12:23:23.219949Z","iopub.status.idle":"2023-05-01T12:23:24.537550Z","shell.execute_reply.started":"2023-05-01T12:23:23.219911Z","shell.execute_reply":"2023-05-01T12:23:24.536448Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"q_mean = train_labels.groupby('question')['correct'].mean()\nq_mean.name = 'q_mean'\nq_mean = q_mean.reset_index()\nq_mean","metadata":{"execution":{"iopub.status.busy":"2023-05-01T12:23:28.262780Z","iopub.execute_input":"2023-05-01T12:23:28.263191Z","iopub.status.idle":"2023-05-01T12:23:28.298468Z","shell.execute_reply.started":"2023-05-01T12:23:28.263148Z","shell.execute_reply":"2023-05-01T12:23:28.297225Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import jo_wilder\nenv = jo_wilder.make_env()\nprint(env)\niter_test = env.iter_test()\nprint(iter_test)","metadata":{"execution":{"iopub.status.busy":"2023-05-01T12:23:31.555919Z","iopub.execute_input":"2023-05-01T12:23:31.556323Z","iopub.status.idle":"2023-05-01T12:23:31.586456Z","shell.execute_reply.started":"2023-05-01T12:23:31.556286Z","shell.execute_reply":"2023-05-01T12:23:31.585512Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for (test, sample_submission) in iter_test:\n#     print(test.columns)\n#     print(test.shape)\n    sample_submission['question'] = [int(label.split('_')[1][1:]) for label in sample_submission['session_id']]\n    df = sample_submission\n    df.loc[df.question == 1, 'correct'] = 0\n    df.loc[df.question == 2, 'correct'] = 0  \n    df.loc[df.question == 3, 'correct'] = 0\n    df.loc[df.question == 4, 'correct'] = 0\n    df.loc[df.question == 5, 'correct'] = 0 \n    df.loc[df.question == 6, 'correct'] = 0 \n    df.loc[df.question == 7, 'correct'] = 0 \n    df.loc[df.question == 8, 'correct'] = 0 \n    df.loc[df.question == 9, 'correct'] = 0 \n    df.loc[df.question == 10, 'correct'] = 0\n    df.loc[df.question == 11, 'correct'] = 0\n    df.loc[df.question == 12, 'correct'] = 0 \n    df.loc[df.question == 13, 'correct'] = 0 \n    df.loc[df.question == 14, 'correct'] = 0 \n    df.loc[df.question == 15, 'correct'] = 0\n    df.loc[df.question == 16, 'correct'] = 0\n    df.loc[df.question == 17, 'correct'] = 0\n    df.loc[df.question == 18, 'correct'] = 0\n    sample_submission = df[['session_id', 'correct']]\n    print(sample_submission.tail(10))\n    print('-'*20)\n    env.predict(sample_submission)\n#     print(sample_submission.tail(10))\n#     print('-'*20)\n\n        ","metadata":{"execution":{"iopub.status.busy":"2023-05-01T12:23:32.838817Z","iopub.execute_input":"2023-05-01T12:23:32.839234Z","iopub.status.idle":"2023-05-01T12:23:33.007835Z","shell.execute_reply.started":"2023-05-01T12:23:32.839196Z","shell.execute_reply":"2023-05-01T12:23:33.005509Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(len(sample_submission))\nprint(sample_submission.dtypes)\nprint(sample_submission.head())\nprint(test.columns)\nprint(test.shape)\nprint(df.correct.mean())","metadata":{"execution":{"iopub.status.busy":"2023-05-01T12:23:39.019359Z","iopub.execute_input":"2023-05-01T12:23:39.019856Z","iopub.status.idle":"2023-05-01T12:23:39.031815Z","shell.execute_reply.started":"2023-05-01T12:23:39.019811Z","shell.execute_reply":"2023-05-01T12:23:39.030605Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv('submission.csv', encoding='cp932', names = ['session_id','correct'])\ndf = df.drop([0])\nprint(df)\n","metadata":{"execution":{"iopub.status.busy":"2023-04-30T09:16:54.754209Z","iopub.status.idle":"2023-04-30T09:16:54.754965Z","shell.execute_reply.started":"2023-04-30T09:16:54.754744Z","shell.execute_reply":"2023-04-30T09:16:54.754769Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# sample_submission = pd.read_csv('/kaggle/input/predict-student-performance-from-game-play/sample_submission.csv', header=0, names=['session_id', 'correct','session_level'])\n# sample_submission = sample_submission[['session_id', 'correct']]\n# print(sample_submission)","metadata":{"execution":{"iopub.status.busy":"2023-04-30T09:16:54.756321Z","iopub.status.idle":"2023-04-30T09:16:54.757131Z","shell.execute_reply.started":"2023-04-30T09:16:54.756898Z","shell.execute_reply":"2023-04-30T09:16:54.756923Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\n# sample_submission.head(50)\n# # sample_submission['correct'].dypes\n# # df.dtypes（\n","metadata":{"execution":{"iopub.status.busy":"2023-04-30T09:16:54.758438Z","iopub.status.idle":"2023-04-30T09:16:54.759272Z","shell.execute_reply.started":"2023-04-30T09:16:54.759039Z","shell.execute_reply":"2023-04-30T09:16:54.759064Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# df['correct']= pd.to_numeric(df['correct'], errors=\"coerce\")\n# df.to_csv('submission.csv')\n# print( df.shape )\n# df.head(15)\n\n# env.predict(df)","metadata":{"execution":{"iopub.status.busy":"2023-04-30T09:16:54.760623Z","iopub.status.idle":"2023-04-30T09:16:54.761419Z","shell.execute_reply.started":"2023-04-30T09:16:54.761199Z","shell.execute_reply":"2023-04-30T09:16:54.761223Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}