{"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":"code","source":"import pandas as pd","metadata":{"papermill":{"duration":1.027875,"end_time":"2023-02-07T00:59:59.180261","exception":false,"start_time":"2023-02-07T00:59:58.152386","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-02-14T23:53:15.287324Z","iopub.execute_input":"2023-02-14T23:53:15.287960Z","iopub.status.idle":"2023-02-14T23:53:15.321331Z","shell.execute_reply.started":"2023-02-14T23:53:15.287839Z","shell.execute_reply":"2023-02-14T23:53:15.320427Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"target = pd.read_csv('/kaggle/input/predict-student-performance-from-game-play/train_labels.csv')\ntarget","metadata":{"execution":{"iopub.status.busy":"2023-02-14T23:53:15.323003Z","iopub.execute_input":"2023-02-14T23:53:15.323572Z","iopub.status.idle":"2023-02-14T23:53:15.651998Z","shell.execute_reply.started":"2023-02-14T23:53:15.323539Z","shell.execute_reply":"2023-02-14T23:53:15.651061Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"target['question'] = target['session_id'].apply(lambda question: question[19::])\ntarget","metadata":{"execution":{"iopub.status.busy":"2023-02-14T23:53:15.653424Z","iopub.execute_input":"2023-02-14T23:53:15.654562Z","iopub.status.idle":"2023-02-14T23:53:15.732504Z","shell.execute_reply.started":"2023-02-14T23:53:15.654523Z","shell.execute_reply":"2023-02-14T23:53:15.731496Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"target.groupby('question')['correct'].mean()\n# question 13 and 15 is above 0.5","metadata":{"execution":{"iopub.status.busy":"2023-02-14T23:53:15.735467Z","iopub.execute_input":"2023-02-14T23:53:15.735846Z","iopub.status.idle":"2023-02-14T23:53:15.772542Z","shell.execute_reply.started":"2023-02-14T23:53:15.735815Z","shell.execute_reply":"2023-02-14T23:53:15.771611Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# KAGGLE API\nimport jo_wilder\nenv = jo_wilder.make_env()\niter_test = env.iter_test()","metadata":{"papermill":{"duration":0.052132,"end_time":"2023-02-07T01:02:44.464739","exception":false,"start_time":"2023-02-07T01:02:44.412607","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-02-14T23:53:15.773828Z","iopub.execute_input":"2023-02-14T23:53:15.774887Z","iopub.status.idle":"2023-02-14T23:53:15.805249Z","shell.execute_reply.started":"2023-02-14T23:53:15.774850Z","shell.execute_reply":"2023-02-14T23:53:15.803892Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for (sample_submission, test) in iter_test:\n    q_13 = sample_submission.session_id.str.contains(f'q{13}')\n    q_15 = sample_submission.session_id.str.contains(f'q{15}')\n    sample_submission.loc[q_13 | q_15, 'correct'] = 0\n    sample_submission.loc[~(q_13 | q_15), ['correct']] = 1\n    #results.predict(X_sm)\n    env.predict(sample_submission)","metadata":{"papermill":{"duration":1.002014,"end_time":"2023-02-07T01:02:45.47927","exception":false,"start_time":"2023-02-07T01:02:44.477256","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-02-14T23:53:15.806876Z","iopub.execute_input":"2023-02-14T23:53:15.807377Z","iopub.status.idle":"2023-02-14T23:53:15.890792Z","shell.execute_reply.started":"2023-02-14T23:53:15.807342Z","shell.execute_reply":"2023-02-14T23:53:15.889833Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv('submission.csv')\ndf","metadata":{"papermill":{"duration":0.027432,"end_time":"2023-02-07T01:02:45.541022","exception":false,"start_time":"2023-02-07T01:02:45.51359","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-02-14T23:53:15.891975Z","iopub.execute_input":"2023-02-14T23:53:15.895604Z","iopub.status.idle":"2023-02-14T23:53:15.910658Z","shell.execute_reply.started":"2023-02-14T23:53:15.895544Z","shell.execute_reply":"2023-02-14T23:53:15.909827Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.correct.mean()","metadata":{"execution":{"iopub.status.busy":"2023-02-14T23:53:15.912160Z","iopub.execute_input":"2023-02-14T23:53:15.912758Z","iopub.status.idle":"2023-02-14T23:53:15.919824Z","shell.execute_reply.started":"2023-02-14T23:53:15.912727Z","shell.execute_reply":"2023-02-14T23:53:15.918743Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"papermill":{"duration":0.020233,"end_time":"2023-02-07T01:02:45.57314","exception":false,"start_time":"2023-02-07T01:02:45.552907","status":"completed"},"tags":[],"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}