{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.7.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# **LKS DATA SCIENCE SMKN 1 KOTA BEKASI**\n\n# PEMBIMBING\n* Satria Ade Putra\n\n# PESERTA LKS\n* Dicky Asqaelani\n* Adelia\n* Muhammad Iqbal Arief\n\n","metadata":{}},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport polars as pl\nimport seaborn as sns\nimport matplotlib.pyplot as plt\n","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-04-27T14:42:45.421917Z","iopub.execute_input":"2023-04-27T14:42:45.422249Z","iopub.status.idle":"2023-04-27T14:42:46.893908Z","shell.execute_reply.started":"2023-04-27T14:42:45.422218Z","shell.execute_reply":"2023-04-27T14:42:46.892665Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Data Cleansing menghapus baris data yang kosong pada train.csv\ndef cleaning():\n    return lambda x:x.fillna( ((x.mean() / x.std())-x.mean()) )\n#Z.transformation\ndef transformasi():\n    return lambda x: (x - x.mean()) / x.std()\n#hapus text_label session_id\ndef hapustext():\n    return lambda x: int(x.split('_')[0])","metadata":{"execution":{"iopub.status.busy":"2023-04-27T14:43:48.065496Z","iopub.execute_input":"2023-04-27T14:43:48.066285Z","iopub.status.idle":"2023-04-27T14:43:48.072844Z","shell.execute_reply.started":"2023-04-27T14:43:48.066248Z","shell.execute_reply":"2023-04-27T14:43:48.071624Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Load Data Train dan tampilkan potongan data\ndtypes={\n    'elapsed_time':np.int32,\n    'event_name':'category',\n    'name':'category',\n    'level':np.uint8,\n    'room_coor_x':np.float32,\n    'room_coor_y':np.float32,\n    'screen_coor_x':np.float32,\n    'screen_coor_y':np.float32,\n    'hover_duration':np.float32,\n    'text':'category',\n    'fqid':'category',\n    'room_fqid':'category',\n    'text_fqid':'category',\n    'fullscreen':'category',\n    'hq':'category',\n    'music':'category',\n    'level_group':'category'}\ntrain = pd.read_csv(\"/kaggle/input/predict-student-performance-from-game-play/train.csv\",dtype=dtypes)\n\ntrain.head()","metadata":{"execution":{"iopub.status.busy":"2023-04-27T14:44:38.809211Z","iopub.execute_input":"2023-04-27T14:44:38.810312Z","iopub.status.idle":"2023-04-27T14:46:28.599756Z","shell.execute_reply.started":"2023-04-27T14:44:38.810261Z","shell.execute_reply":"2023-04-27T14:46:28.598442Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.describe()","metadata":{"execution":{"iopub.status.busy":"2023-04-27T13:26:42.933902Z","iopub.execute_input":"2023-04-27T13:26:42.934843Z","iopub.status.idle":"2023-04-27T13:26:55.39093Z","shell.execute_reply.started":"2023-04-27T13:26:42.934787Z","shell.execute_reply":"2023-04-27T13:26:55.389777Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.isna().sum()","metadata":{"execution":{"iopub.status.busy":"2023-04-27T14:48:05.115773Z","iopub.execute_input":"2023-04-27T14:48:05.116621Z","iopub.status.idle":"2023-04-27T14:48:05.895493Z","shell.execute_reply.started":"2023-04-27T14:48:05.116577Z","shell.execute_reply":"2023-04-27T14:48:05.894015Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = train.dropna()","metadata":{"execution":{"iopub.status.busy":"2023-04-27T14:49:03.822868Z","iopub.execute_input":"2023-04-27T14:49:03.823593Z","iopub.status.idle":"2023-04-27T14:49:05.868662Z","shell.execute_reply.started":"2023-04-27T14:49:03.823536Z","shell.execute_reply":"2023-04-27T14:49:05.867332Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.isna().sum()","metadata":{"execution":{"iopub.status.busy":"2023-04-27T14:49:15.547324Z","iopub.execute_input":"2023-04-27T14:49:15.54782Z","iopub.status.idle":"2023-04-27T14:49:15.607154Z","shell.execute_reply.started":"2023-04-27T14:49:15.547773Z","shell.execute_reply":"2023-04-27T14:49:15.603788Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.head()","metadata":{"execution":{"iopub.status.busy":"2023-04-27T14:50:00.056768Z","iopub.execute_input":"2023-04-27T14:50:00.057193Z","iopub.status.idle":"2023-04-27T14:50:00.075362Z","shell.execute_reply.started":"2023-04-27T14:50:00.057157Z","shell.execute_reply":"2023-04-27T14:50:00.074129Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#load data train_labels\nlabels = pd.read_csv(\"/kaggle/input/predict-student-performance-from-game-play/train_labels.csv\")\n","metadata":{"execution":{"iopub.status.busy":"2023-04-27T13:50:16.686664Z","iopub.execute_input":"2023-04-27T13:50:16.687332Z","iopub.status.idle":"2023-04-27T13:50:17.063846Z","shell.execute_reply.started":"2023-04-27T13:50:16.687294Z","shell.execute_reply":"2023-04-27T13:50:17.062758Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#tampilkan train_labels\nlabels.head()","metadata":{"execution":{"iopub.status.busy":"2023-04-27T13:50:19.596988Z","iopub.execute_input":"2023-04-27T13:50:19.598322Z","iopub.status.idle":"2023-04-27T13:50:19.617182Z","shell.execute_reply.started":"2023-04-27T13:50:19.598273Z","shell.execute_reply":"2023-04-27T13:50:19.616129Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels.describe()","metadata":{"execution":{"iopub.status.busy":"2023-04-27T13:50:22.708565Z","iopub.execute_input":"2023-04-27T13:50:22.709316Z","iopub.status.idle":"2023-04-27T13:50:22.753223Z","shell.execute_reply.started":"2023-04-27T13:50:22.709268Z","shell.execute_reply":"2023-04-27T13:50:22.752065Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels['session'] = labels.session_id.apply(lambda x: int(x.split('_')[0]))\nlabels['q'] = labels.session_id.apply(lambda x: int(x.split('_')[-1][1:]))","metadata":{"execution":{"iopub.status.busy":"2023-04-27T13:51:49.587366Z","iopub.execute_input":"2023-04-27T13:51:49.58775Z","iopub.status.idle":"2023-04-27T13:51:50.218873Z","shell.execute_reply.started":"2023-04-27T13:51:49.587716Z","shell.execute_reply":"2023-04-27T13:51:50.217821Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels = pd.DataFrame(train_labels[['session_id','session','q','correct']])","metadata":{"execution":{"iopub.status.busy":"2023-04-27T13:58:21.726429Z","iopub.execute_input":"2023-04-27T13:58:21.726871Z","iopub.status.idle":"2023-04-27T13:58:21.745236Z","shell.execute_reply.started":"2023-04-27T13:58:21.726833Z","shell.execute_reply":"2023-04-27T13:58:21.744085Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels.head(5)","metadata":{"execution":{"iopub.status.busy":"2023-04-27T13:58:29.841077Z","iopub.execute_input":"2023-04-27T13:58:29.842074Z","iopub.status.idle":"2023-04-27T13:58:29.852975Z","shell.execute_reply.started":"2023-04-27T13:58:29.842022Z","shell.execute_reply":"2023-04-27T13:58:29.851712Z"},"trusted":true},"execution_count":null,"outputs":[]}]}