{"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":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport polars as pl\nfrom matplotlib import pyplot as plt\nimport seaborn as sns\nplt.style.use('fivethirtyeight')\nplt.rcParams['figure.figsize'] = (30, 20)\nsns.set_style('darkgrid')\n\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-05-04T14:07:57.929733Z","iopub.execute_input":"2023-05-04T14:07:57.930101Z","iopub.status.idle":"2023-05-04T14:07:58.696685Z","shell.execute_reply.started":"2023-05-04T14:07:57.930067Z","shell.execute_reply":"2023-05-04T14:07:58.69511Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_id = pl.read_csv('/kaggle/input/predict-student-performance-from-game-play/train.csv', columns = ['index'])\ndisplay(train_id)","metadata":{"execution":{"iopub.status.busy":"2023-04-29T12:40:08.435171Z","iopub.execute_input":"2023-04-29T12:40:08.435568Z","iopub.status.idle":"2023-04-29T12:40:36.313602Z","shell.execute_reply.started":"2023-04-29T12:40:08.435531Z","shell.execute_reply":"2023-04-29T12:40:36.312633Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tmp = pd.read_csv('/kaggle/input/predict-student-performance-from-game-play/train.csv', usecols=[0])\ntmp.head()","metadata":{"execution":{"iopub.status.busy":"2023-05-04T14:08:21.564028Z","iopub.execute_input":"2023-05-04T14:08:21.564406Z","iopub.status.idle":"2023-05-04T14:09:47.760475Z","shell.execute_reply.started":"2023-05-04T14:08:21.564375Z","shell.execute_reply":"2023-05-04T14:09:47.759451Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tmp['session_id'].hist(bins = 30)","metadata":{"execution":{"iopub.status.busy":"2023-05-03T12:57:49.816794Z","iopub.execute_input":"2023-05-03T12:57:49.817232Z","iopub.status.idle":"2023-05-03T12:57:51.026678Z","shell.execute_reply.started":"2023-05-03T12:57:49.817194Z","shell.execute_reply":"2023-05-03T12:57:51.025508Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tmp = pd.read_csv('/kaggle/input/predict-student-performance-from-game-play/train.csv', usecols=[1])\ntmp.head()","metadata":{"execution":{"iopub.status.busy":"2023-04-29T12:42:09.359879Z","iopub.execute_input":"2023-04-29T12:42:09.360962Z","iopub.status.idle":"2023-04-29T12:42:36.753774Z","shell.execute_reply.started":"2023-04-29T12:42:09.360915Z","shell.execute_reply":"2023-04-29T12:42:36.752718Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tmp['index'].hist(bins = 10)","metadata":{"execution":{"iopub.status.busy":"2023-04-29T12:43:02.877226Z","iopub.execute_input":"2023-04-29T12:43:02.877619Z","iopub.status.idle":"2023-04-29T12:43:03.91977Z","shell.execute_reply.started":"2023-04-29T12:43:02.877583Z","shell.execute_reply":"2023-04-29T12:43:03.918727Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tmp = pd.read_csv('/kaggle/input/predict-student-performance-from-game-play/train.csv', usecols=[3])\ntmp.head()","metadata":{"execution":{"iopub.status.busy":"2023-04-29T12:43:11.379529Z","iopub.execute_input":"2023-04-29T12:43:11.380691Z","iopub.status.idle":"2023-04-29T12:43:39.870677Z","shell.execute_reply.started":"2023-04-29T12:43:11.380644Z","shell.execute_reply":"2023-04-29T12:43:39.86962Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tmp['event_name'].hist(bins = 30)","metadata":{"execution":{"iopub.status.busy":"2023-04-29T12:44:02.782611Z","iopub.execute_input":"2023-04-29T12:44:02.783352Z","iopub.status.idle":"2023-04-29T12:44:13.980454Z","shell.execute_reply.started":"2023-04-29T12:44:02.783312Z","shell.execute_reply":"2023-04-29T12:44:13.979484Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tmp = pd.read_csv('/kaggle/input/predict-student-performance-from-game-play/train.csv', usecols=[4])\ntmp.head()","metadata":{"execution":{"iopub.status.busy":"2023-04-29T12:44:22.728154Z","iopub.execute_input":"2023-04-29T12:44:22.728635Z","iopub.status.idle":"2023-04-29T12:45:26.955771Z","shell.execute_reply.started":"2023-04-29T12:44:22.728598Z","shell.execute_reply":"2023-04-29T12:45:26.954184Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tmp['name'].hist(bins = 30)","metadata":{"execution":{"iopub.status.busy":"2023-04-29T12:46:02.780008Z","iopub.execute_input":"2023-04-29T12:46:02.781149Z","iopub.status.idle":"2023-04-29T12:46:14.923965Z","shell.execute_reply.started":"2023-04-29T12:46:02.781106Z","shell.execute_reply":"2023-04-29T12:46:14.921069Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tmp = pd.read_csv('/kaggle/input/predict-student-performance-from-game-play/train.csv', usecols=[5])\ntmp.head()","metadata":{"execution":{"iopub.status.busy":"2023-04-29T12:46:24.211571Z","iopub.execute_input":"2023-04-29T12:46:24.211975Z","iopub.status.idle":"2023-04-29T12:47:00.019928Z","shell.execute_reply.started":"2023-04-29T12:46:24.211939Z","shell.execute_reply":"2023-04-29T12:47:00.018844Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tmp = pd.read_csv('/kaggle/input/predict-student-performance-from-game-play/train.csv', usecols=[6])\ntmp.head()","metadata":{"execution":{"iopub.status.busy":"2023-05-03T12:58:21.67467Z","iopub.execute_input":"2023-05-03T12:58:21.675102Z","iopub.status.idle":"2023-05-03T12:58:48.572519Z","shell.execute_reply.started":"2023-05-03T12:58:21.675065Z","shell.execute_reply":"2023-05-03T12:58:48.571398Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tmp['page'].hist(bins = 30)","metadata":{"execution":{"iopub.status.busy":"2023-05-03T12:58:52.403519Z","iopub.execute_input":"2023-05-03T12:58:52.403913Z","iopub.status.idle":"2023-05-03T12:58:53.105343Z","shell.execute_reply.started":"2023-05-03T12:58:52.40388Z","shell.execute_reply":"2023-05-03T12:58:53.104439Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tmp = pd.read_csv('/kaggle/input/predict-student-performance-from-game-play/train.csv', usecols=[7])\ntmp.head()","metadata":{"execution":{"iopub.status.busy":"2023-05-03T12:58:57.144562Z","iopub.execute_input":"2023-05-03T12:58:57.14498Z","iopub.status.idle":"2023-05-03T12:59:25.776913Z","shell.execute_reply.started":"2023-05-03T12:58:57.144943Z","shell.execute_reply":"2023-05-03T12:59:25.775869Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tmp['room_coor_x'].hist()","metadata":{"execution":{"iopub.status.busy":"2023-05-03T13:00:06.5482Z","iopub.execute_input":"2023-05-03T13:00:06.548621Z","iopub.status.idle":"2023-05-03T13:00:07.832371Z","shell.execute_reply.started":"2023-05-03T13:00:06.548587Z","shell.execute_reply":"2023-05-03T13:00:07.82928Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.set()\ntmp.room_coor_x.plot.hist(bins=30)","metadata":{"execution":{"iopub.status.busy":"2023-05-03T13:00:16.053959Z","iopub.execute_input":"2023-05-03T13:00:16.054693Z","iopub.status.idle":"2023-05-03T13:00:20.690558Z","shell.execute_reply.started":"2023-05-03T13:00:16.054635Z","shell.execute_reply":"2023-05-03T13:00:20.688981Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\nnp.random.seed(100)\nangka = []\nfor i in range (0, 100):\n    angka.append(i)","metadata":{"execution":{"iopub.status.busy":"2023-05-03T13:00:39.096725Z","iopub.execute_input":"2023-05-03T13:00:39.097121Z","iopub.status.idle":"2023-05-03T13:00:39.102264Z","shell.execute_reply.started":"2023-05-03T13:00:39.097086Z","shell.execute_reply":"2023-05-03T13:00:39.101129Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"baru = pd.DataFrame(np.random.rand(100, 5), angka,['A','B','C','D','E'])","metadata":{"execution":{"iopub.status.busy":"2023-05-03T13:00:48.677449Z","iopub.execute_input":"2023-05-03T13:00:48.677844Z","iopub.status.idle":"2023-05-03T13:00:48.684309Z","shell.execute_reply.started":"2023-05-03T13:00:48.677811Z","shell.execute_reply":"2023-05-03T13:00:48.683145Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"baru.head()","metadata":{"execution":{"iopub.status.busy":"2023-05-03T13:00:50.350906Z","iopub.execute_input":"2023-05-03T13:00:50.351318Z","iopub.status.idle":"2023-05-03T13:00:50.367668Z","shell.execute_reply.started":"2023-05-03T13:00:50.351283Z","shell.execute_reply":"2023-05-03T13:00:50.366437Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"baru.plot.area()","metadata":{"execution":{"iopub.status.busy":"2023-05-03T13:00:55.232641Z","iopub.execute_input":"2023-05-03T13:00:55.233044Z","iopub.status.idle":"2023-05-03T13:00:56.256138Z","shell.execute_reply.started":"2023-05-03T13:00:55.233009Z","shell.execute_reply":"2023-05-03T13:00:56.255135Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"baru2 = pd.DataFrame(np.random.rand(4,5),[0,1,2,3],['A','B','C','D','E'])","metadata":{"execution":{"iopub.status.busy":"2023-05-03T13:01:05.225658Z","iopub.execute_input":"2023-05-03T13:01:05.226042Z","iopub.status.idle":"2023-05-03T13:01:05.231156Z","shell.execute_reply.started":"2023-05-03T13:01:05.22601Z","shell.execute_reply":"2023-05-03T13:01:05.230304Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"baru2.plot.bar(stacked=True)","metadata":{"execution":{"iopub.status.busy":"2023-05-03T13:01:07.344982Z","iopub.execute_input":"2023-05-03T13:01:07.345381Z","iopub.status.idle":"2023-05-03T13:01:07.895974Z","shell.execute_reply.started":"2023-05-03T13:01:07.345349Z","shell.execute_reply":"2023-05-03T13:01:07.895074Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"baru.plot.scatter(x='A', y='B', c='E', cmap='ocean')","metadata":{"execution":{"iopub.status.busy":"2023-05-03T13:01:12.443505Z","iopub.execute_input":"2023-05-03T13:01:12.443961Z","iopub.status.idle":"2023-05-03T13:01:13.071782Z","shell.execute_reply.started":"2023-05-03T13:01:12.443922Z","shell.execute_reply":"2023-05-03T13:01:13.070916Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"baru.plot.box()","metadata":{"execution":{"iopub.status.busy":"2023-05-03T13:01:21.31963Z","iopub.execute_input":"2023-05-03T13:01:21.320035Z","iopub.status.idle":"2023-05-03T13:01:21.831999Z","shell.execute_reply.started":"2023-05-03T13:01:21.319999Z","shell.execute_reply":"2023-05-03T13:01:21.830952Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"baru.plot.line(y = 'B')","metadata":{"execution":{"iopub.status.busy":"2023-05-03T13:01:25.795272Z","iopub.execute_input":"2023-05-03T13:01:25.796168Z","iopub.status.idle":"2023-05-03T13:01:26.60731Z","shell.execute_reply.started":"2023-05-03T13:01:25.796124Z","shell.execute_reply":"2023-05-03T13:01:26.606162Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"n_train = len(train_id)","metadata":{"execution":{"iopub.status.busy":"2023-05-03T13:01:32.672848Z","iopub.execute_input":"2023-05-03T13:01:32.673259Z","iopub.status.idle":"2023-05-03T13:01:32.690767Z","shell.execute_reply.started":"2023-05-03T13:01:32.673226Z","shell.execute_reply":"2023-05-03T13:01:32.689401Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import gc\ngc.enable()\ndel n_train\ngc.collect()","metadata":{"execution":{"iopub.status.busy":"2023-05-03T13:01:55.368375Z","iopub.execute_input":"2023-05-03T13:01:55.368789Z","iopub.status.idle":"2023-05-03T13:01:55.384223Z","shell.execute_reply.started":"2023-05-03T13:01:55.368756Z","shell.execute_reply":"2023-05-03T13:01:55.383127Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tmp = tmp.groupby('session_id').session_id.agg('count')\nprint(tmp)","metadata":{"execution":{"iopub.status.busy":"2023-05-03T13:01:41.415969Z","iopub.execute_input":"2023-05-03T13:01:41.416374Z","iopub.status.idle":"2023-05-03T13:01:41.444123Z","shell.execute_reply.started":"2023-05-03T13:01:41.41634Z","shell.execute_reply":"2023-05-03T13:01:41.442766Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tmp.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-05-03T13:01:44.949859Z","iopub.execute_input":"2023-05-03T13:01:44.950265Z","iopub.status.idle":"2023-05-03T13:01:45.00645Z","shell.execute_reply.started":"2023-05-03T13:01:44.95023Z","shell.execute_reply":"2023-05-03T13:01:45.005365Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dtyping = {\n    'session_id' : np.uint64,\n    'index' : np.uint16,\n    'elapsed_time' : np.uint16,\n    'event_name' : 'category',\n    'name' : 'category',\n    'level' : np.uint8,\n    'page' : np.uint16,\n    'room_coor_x' : np.float16,\n    'room_coor_y' : np.float16,\n    'screen_coor_y' : np.float16,\n    'screen_coor_y' : np.float16,\n    'hover_duration' : np.float16,\n    'text' : 'category',\n    'fqid' : 'category',\n    'room_fqid' : 'category',\n    'screen_fqid' : 'category',\n    'full_screen' : np.bool8,\n    'hq' : np.bool8,\n    'music' : np.bool8,\n    'level_group' : 'category'\n    \n}","metadata":{"execution":{"iopub.status.busy":"2023-05-04T14:08:11.05595Z","iopub.execute_input":"2023-05-04T14:08:11.056332Z","iopub.status.idle":"2023-05-04T14:08:11.062899Z","shell.execute_reply.started":"2023-05-04T14:08:11.056295Z","shell.execute_reply":"2023-05-04T14:08:11.062038Z"},"trusted":true},"execution_count":null,"outputs":[]}]}