{"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":"# ![Header](https://storage.googleapis.com/kaggle-competitions/kaggle/45533/logos/header.png?t=2023-01-31-14-40-43)\n\n# Competition information\n## url\nhttps://www.kaggle.com/competitions/predict-student-performance-from-game-play\n\n# Game information\n\n## Source code\nhttps://github.com/fielddaylab/jo_wilder\n\n## YouTube introduction\nhttps://www.youtube.com/watch?v=GCBRRmm7T9k\n\n## Play it\nhttps://pbswisconsineducation.org/jowilder/play-the-game/","metadata":{}},{"cell_type":"markdown","source":"# Loading the data\n\nAs the training data kept crashing my notebook, I loaded this in another notebook locally, and got the dtypes from there","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nimport numpy as np","metadata":{"execution":{"iopub.status.busy":"2023-03-11T11:46:30.365234Z","iopub.execute_input":"2023-03-11T11:46:30.365608Z","iopub.status.idle":"2023-03-11T11:46:30.370326Z","shell.execute_reply.started":"2023-03-11T11:46:30.365576Z","shell.execute_reply":"2023-03-11T11:46:30.369291Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = pd.read_csv('/kaggle/input/predict-student-performance-from-game-play/train.csv', dtype={\n'session_id': np.int64,\n'index': np.int16,\n'elapsed_time': np.int32,\n'level': np.int8,\n'page': np.float16,\n'room_coor_x': np.float16,\n'room_coor_y': np.float16,\n'screen_coor_x': np.float16,\n'screen_coor_y': np.float16,\n'hover_duration': np.float32,\n'fullscreen': np.float64,\n'hq': np.float64,\n'music': np.float64,\n})\nprint(f'Memory used: {train.memory_usage(index=True, deep=True).sum() / 1024**2:_.2f} MB')\nprint(train.shape)\ntrain.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-11T11:46:31.405921Z","iopub.execute_input":"2023-03-11T11:46:31.406297Z","iopub.status.idle":"2023-03-11T11:47:36.860779Z","shell.execute_reply.started":"2023-03-11T11:46:31.406263Z","shell.execute_reply":"2023-03-11T11:47:36.859701Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels = pd.read_csv('/kaggle/input/predict-student-performance-from-game-play/train_labels.csv')\nprint(labels.shape)\nlabels.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-11T11:49:25.707867Z","iopub.execute_input":"2023-03-11T11:49:25.708302Z","iopub.status.idle":"2023-03-11T11:49:25.972036Z","shell.execute_reply.started":"2023-03-11T11:49:25.708267Z","shell.execute_reply":"2023-03-11T11:49:25.971141Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.read_csv('/kaggle/input/predict-student-performance-from-game-play/sample_submission.csv').head()","metadata":{"execution":{"iopub.status.busy":"2023-03-11T11:49:27.790404Z","iopub.execute_input":"2023-03-11T11:49:27.790811Z","iopub.status.idle":"2023-03-11T11:49:27.808829Z","shell.execute_reply.started":"2023-03-11T11:49:27.790775Z","shell.execute_reply":"2023-03-11T11:49:27.807954Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels[labels.session_id.str.startswith('20090312431273200')].head()","metadata":{"execution":{"iopub.status.busy":"2023-03-11T11:49:30.822651Z","iopub.execute_input":"2023-03-11T11:49:30.823071Z","iopub.status.idle":"2023-03-11T11:49:30.943169Z","shell.execute_reply.started":"2023-03-11T11:49:30.823035Z","shell.execute_reply":"2023-03-11T11:49:30.942025Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train[train.session_id == 20090312431273200].head()","metadata":{"execution":{"iopub.status.busy":"2023-03-11T11:49:31.015245Z","iopub.execute_input":"2023-03-11T11:49:31.017820Z","iopub.status.idle":"2023-03-11T11:49:31.146478Z","shell.execute_reply.started":"2023-03-11T11:49:31.017770Z","shell.execute_reply":"2023-03-11T11:49:31.145634Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Cleanup labels","metadata":{}},{"cell_type":"code","source":"labels[['session', 'q']] = labels.session_id.str.split('_q', expand=True).astype(int)","metadata":{"execution":{"iopub.status.busy":"2023-03-11T11:49:32.590422Z","iopub.execute_input":"2023-03-11T11:49:32.590813Z","iopub.status.idle":"2023-03-11T11:49:33.501095Z","shell.execute_reply.started":"2023-03-11T11:49:32.590779Z","shell.execute_reply":"2023-03-11T11:49:33.500019Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Split training data","metadata":{}},{"cell_type":"code","source":"group1 = train[train.level_group == '0-4']\ngroup2 = train[train.level_group == '5-12']\ngroup3 = train[train.level_group == '13-22']","metadata":{},"execution_count":null,"outputs":[]}]}