{"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":"## Predict Student Performance from Game Play","metadata":{}},{"cell_type":"markdown","source":"Online educational games can collect a wide variety of data about student performance, such as time spent playing, progress through game levels, scores, and quiz results. This data can be used to identify patterns and predict future performance. For example, if a student has consistently performed well on certain types of activities in the game, it's likely that they will continue to do so in the future.\n\nBy analyzing this data over time, educators can also track how student learning progresses over time. This information can be used to identify areas where students are struggling and provide additional support or resources. Similarly, data can be used to identify areas where students are excelling and to provide additional challenges or opportunities for growth.\n\nOverall, data from online educational games can provide valuable insights into student performance and learning. By using this data effectively, educators can provide targeted and personalized support to help students succeed","metadata":{}},{"cell_type":"markdown","source":"# Data","metadata":{}},{"cell_type":"code","source":"import os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:33:10.705581Z","iopub.execute_input":"2023-03-11T02:33:10.705938Z","iopub.status.idle":"2023-03-11T02:33:10.758325Z","shell.execute_reply.started":"2023-03-11T02:33:10.705904Z","shell.execute_reply":"2023-03-11T02:33:10.757275Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd \nimport numpy as np ","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:33:10.760006Z","iopub.execute_input":"2023-03-11T02:33:10.760308Z","iopub.status.idle":"2023-03-11T02:33:10.764733Z","shell.execute_reply.started":"2023-03-11T02:33:10.760278Z","shell.execute_reply":"2023-03-11T02:33:10.763462Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample = pd.read_csv(\"//kaggle/input/gameplay/sample_submission.csv\")\n","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:33:10.767036Z","iopub.execute_input":"2023-03-11T02:33:10.76777Z","iopub.status.idle":"2023-03-11T02:33:10.791712Z","shell.execute_reply.started":"2023-03-11T02:33:10.767728Z","shell.execute_reply":"2023-03-11T02:33:10.790575Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:33:10.793645Z","iopub.execute_input":"2023-03-11T02:33:10.794369Z","iopub.status.idle":"2023-03-11T02:33:10.82005Z","shell.execute_reply.started":"2023-03-11T02:33:10.794335Z","shell.execute_reply":"2023-03-11T02:33:10.818799Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = pd.read_csv(\"/kaggle/input/train-for-predict-gameplay/train.csv\")\n\n","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:33:10.821892Z","iopub.execute_input":"2023-03-11T02:33:10.822514Z","iopub.status.idle":"2023-03-11T02:34:07.176157Z","shell.execute_reply.started":"2023-03-11T02:33:10.822477Z","shell.execute_reply":"2023-03-11T02:34:07.175411Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"page , name index , event name ","metadata":{}},{"cell_type":"code","source":"train.columns","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:07.17747Z","iopub.execute_input":"2023-03-11T02:34:07.178364Z","iopub.status.idle":"2023-03-11T02:34:07.185054Z","shell.execute_reply.started":"2023-03-11T02:34:07.178323Z","shell.execute_reply":"2023-03-11T02:34:07.184195Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nX = train[['page','name','event_name','level','index']]\n\n","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:07.186171Z","iopub.execute_input":"2023-03-11T02:34:07.18645Z","iopub.status.idle":"2023-03-11T02:34:07.452338Z","shell.execute_reply.started":"2023-03-11T02:34:07.186423Z","shell.execute_reply":"2023-03-11T02:34:07.45105Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:07.453508Z","iopub.execute_input":"2023-03-11T02:34:07.453857Z","iopub.status.idle":"2023-03-11T02:34:07.468716Z","shell.execute_reply.started":"2023-03-11T02:34:07.453823Z","shell.execute_reply":"2023-03-11T02:34:07.46726Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test = pd.read_csv(\"/kaggle/input/gameplay/test.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:07.470134Z","iopub.execute_input":"2023-03-11T02:34:07.470456Z","iopub.status.idle":"2023-03-11T02:34:07.513061Z","shell.execute_reply.started":"2023-03-11T02:34:07.470423Z","shell.execute_reply":"2023-03-11T02:34:07.511867Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_label = pd.read_csv(\"/kaggle/input/gameplay/train_labels.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:07.517428Z","iopub.execute_input":"2023-03-11T02:34:07.517924Z","iopub.status.idle":"2023-03-11T02:34:07.735928Z","shell.execute_reply.started":"2023-03-11T02:34:07.517866Z","shell.execute_reply":"2023-03-11T02:34:07.734571Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:07.73787Z","iopub.execute_input":"2023-03-11T02:34:07.738213Z","iopub.status.idle":"2023-03-11T02:34:07.76097Z","shell.execute_reply.started":"2023-03-11T02:34:07.738179Z","shell.execute_reply":"2023-03-11T02:34:07.759353Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:07.762671Z","iopub.execute_input":"2023-03-11T02:34:07.763145Z","iopub.status.idle":"2023-03-11T02:34:07.790456Z","shell.execute_reply.started":"2023-03-11T02:34:07.763108Z","shell.execute_reply":"2023-03-11T02:34:07.789166Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_label.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:07.792152Z","iopub.execute_input":"2023-03-11T02:34:07.792555Z","iopub.status.idle":"2023-03-11T02:34:07.811328Z","shell.execute_reply.started":"2023-03-11T02:34:07.792517Z","shell.execute_reply":"2023-03-11T02:34:07.810137Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test['index'].unique","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:07.812196Z","iopub.execute_input":"2023-03-11T02:34:07.812488Z","iopub.status.idle":"2023-03-11T02:34:07.82878Z","shell.execute_reply.started":"2023-03-11T02:34:07.81246Z","shell.execute_reply":"2023-03-11T02:34:07.827481Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(train.shape)\nprint(test.shape)\n","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:07.830521Z","iopub.execute_input":"2023-03-11T02:34:07.830873Z","iopub.status.idle":"2023-03-11T02:34:07.842796Z","shell.execute_reply.started":"2023-03-11T02:34:07.830843Z","shell.execute_reply":"2023-03-11T02:34:07.841009Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# review data ","metadata":{}},{"cell_type":"code","source":"import seaborn as sns \nimport matplotlib.pyplot as plt","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:07.844786Z","iopub.execute_input":"2023-03-11T02:34:07.845209Z","iopub.status.idle":"2023-03-11T02:34:08.41516Z","shell.execute_reply.started":"2023-03-11T02:34:07.845166Z","shell.execute_reply":"2023-03-11T02:34:08.413928Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train['event_name'].unique","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:08.41644Z","iopub.execute_input":"2023-03-11T02:34:08.416737Z","iopub.status.idle":"2023-03-11T02:34:08.426975Z","shell.execute_reply.started":"2023-03-11T02:34:08.41671Z","shell.execute_reply":"2023-03-11T02:34:08.425428Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train['event_name'].describe","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:08.428504Z","iopub.execute_input":"2023-03-11T02:34:08.428821Z","iopub.status.idle":"2023-03-11T02:34:08.440021Z","shell.execute_reply.started":"2023-03-11T02:34:08.428792Z","shell.execute_reply":"2023-03-11T02:34:08.438596Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train['level_group'].unique","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:08.441374Z","iopub.execute_input":"2023-03-11T02:34:08.441978Z","iopub.status.idle":"2023-03-11T02:34:08.453524Z","shell.execute_reply.started":"2023-03-11T02:34:08.44194Z","shell.execute_reply":"2023-03-11T02:34:08.452453Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train['level_group'].describe","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:08.454773Z","iopub.execute_input":"2023-03-11T02:34:08.455115Z","iopub.status.idle":"2023-03-11T02:34:08.464844Z","shell.execute_reply.started":"2023-03-11T02:34:08.455067Z","shell.execute_reply":"2023-03-11T02:34:08.464034Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"- there was 2 type of main even auto navigation and manualy click \n- level for finish the game from 0 until 22 like [0-4 stage ] - [13-22 stage]","metadata":{}},{"cell_type":"code","source":"train['session_id'].describe","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:08.465633Z","iopub.execute_input":"2023-03-11T02:34:08.465936Z","iopub.status.idle":"2023-03-11T02:34:08.481702Z","shell.execute_reply.started":"2023-03-11T02:34:08.465904Z","shell.execute_reply":"2023-03-11T02:34:08.480209Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## check valuable columns and missing value","metadata":{}},{"cell_type":"code","source":"import missingno as msno","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:08.483435Z","iopub.execute_input":"2023-03-11T02:34:08.48387Z","iopub.status.idle":"2023-03-11T02:34:08.496992Z","shell.execute_reply.started":"2023-03-11T02:34:08.483826Z","shell.execute_reply":"2023-03-11T02:34:08.495763Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"msno.bar(train)","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:08.498239Z","iopub.execute_input":"2023-03-11T02:34:08.499609Z","iopub.status.idle":"2023-03-11T02:34:12.88875Z","shell.execute_reply.started":"2023-03-11T02:34:08.499537Z","shell.execute_reply":"2023-03-11T02:34:12.887869Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"msno.bar(test)","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:12.889844Z","iopub.execute_input":"2023-03-11T02:34:12.890986Z","iopub.status.idle":"2023-03-11T02:34:13.987904Z","shell.execute_reply.started":"2023-03-11T02:34:12.890952Z","shell.execute_reply":"2023-03-11T02:34:13.986909Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"- there was no value at all for column fullscrene hq music so we doesn't need this data because can't representative  the data ","metadata":{}},{"cell_type":"code","source":"test.columns","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:13.989151Z","iopub.execute_input":"2023-03-11T02:34:13.989499Z","iopub.status.idle":"2023-03-11T02:34:13.996841Z","shell.execute_reply.started":"2023-03-11T02:34:13.989469Z","shell.execute_reply":"2023-03-11T02:34:13.995613Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test = test[['session_id', 'index', 'elapsed_time', 'event_name', 'name', 'level',\n       'page', 'room_coor_x', 'room_coor_y', 'screen_coor_x', 'screen_coor_y',\n       'hover_duration', 'text', 'fqid', 'room_fqid', 'text_fqid','level_group', 'session_level']]","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:13.997961Z","iopub.execute_input":"2023-03-11T02:34:13.99824Z","iopub.status.idle":"2023-03-11T02:34:14.008641Z","shell.execute_reply.started":"2023-03-11T02:34:13.998212Z","shell.execute_reply":"2023-03-11T02:34:14.006956Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"msno.bar(test)","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:14.015753Z","iopub.execute_input":"2023-03-11T02:34:14.01613Z","iopub.status.idle":"2023-03-11T02:34:14.967892Z","shell.execute_reply.started":"2023-03-11T02:34:14.016094Z","shell.execute_reply":"2023-03-11T02:34:14.966293Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"msno.bar(train)","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:14.969414Z","iopub.execute_input":"2023-03-11T02:34:14.969818Z","iopub.status.idle":"2023-03-11T02:34:19.942589Z","shell.execute_reply.started":"2023-03-11T02:34:14.96978Z","shell.execute_reply":"2023-03-11T02:34:19.941339Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.columns","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:19.943908Z","iopub.execute_input":"2023-03-11T02:34:19.944413Z","iopub.status.idle":"2023-03-11T02:34:19.950099Z","shell.execute_reply.started":"2023-03-11T02:34:19.944355Z","shell.execute_reply":"2023-03-11T02:34:19.949198Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = train[['session_id', 'index', 'elapsed_time', 'event_name', 'name', 'level',\n       'page', 'room_coor_x', 'room_coor_y', 'screen_coor_x', 'screen_coor_y',\n       'hover_duration', 'text', 'fqid', 'room_fqid', 'text_fqid','level_group']]","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:19.951167Z","iopub.execute_input":"2023-03-11T02:34:19.951786Z","iopub.status.idle":"2023-03-11T02:34:24.666197Z","shell.execute_reply.started":"2023-03-11T02:34:19.951757Z","shell.execute_reply":"2023-03-11T02:34:24.662717Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"msno.bar(train)","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:24.669946Z","iopub.execute_input":"2023-03-11T02:34:24.670616Z","iopub.status.idle":"2023-03-11T02:34:29.912616Z","shell.execute_reply.started":"2023-03-11T02:34:24.670553Z","shell.execute_reply":"2023-03-11T02:34:29.91144Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# preprocessing","metadata":{}},{"cell_type":"code","source":"\n\n#visualization \nimport matplotlib.pyplot as plt\nimport seaborn as sns \n\n\n","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:29.914329Z","iopub.execute_input":"2023-03-11T02:34:29.914665Z","iopub.status.idle":"2023-03-11T02:34:29.919858Z","shell.execute_reply.started":"2023-03-11T02:34:29.914636Z","shell.execute_reply":"2023-03-11T02:34:29.918774Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test.columns","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:29.921247Z","iopub.execute_input":"2023-03-11T02:34:29.921652Z","iopub.status.idle":"2023-03-11T02:34:29.938958Z","shell.execute_reply.started":"2023-03-11T02:34:29.921615Z","shell.execute_reply":"2023-03-11T02:34:29.937714Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test['index'].unique","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:29.9406Z","iopub.execute_input":"2023-03-11T02:34:29.94107Z","iopub.status.idle":"2023-03-11T02:34:29.95259Z","shell.execute_reply.started":"2023-03-11T02:34:29.941036Z","shell.execute_reply":"2023-03-11T02:34:29.95069Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"- visualisation student","metadata":{}},{"cell_type":"code","source":"import plotly.graph_objects as go\nfrom plotly.subplots import make_subplots","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:29.954791Z","iopub.execute_input":"2023-03-11T02:34:29.955257Z","iopub.status.idle":"2023-03-11T02:34:30.065889Z","shell.execute_reply.started":"2023-03-11T02:34:29.955212Z","shell.execute_reply":"2023-03-11T02:34:30.064748Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test.columns","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:30.067123Z","iopub.execute_input":"2023-03-11T02:34:30.06747Z","iopub.status.idle":"2023-03-11T02:34:30.075714Z","shell.execute_reply.started":"2023-03-11T02:34:30.067436Z","shell.execute_reply":"2023-03-11T02:34:30.074426Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_label.columns","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:30.077787Z","iopub.execute_input":"2023-03-11T02:34:30.078231Z","iopub.status.idle":"2023-03-11T02:34:30.087889Z","shell.execute_reply.started":"2023-03-11T02:34:30.078185Z","shell.execute_reply":"2023-03-11T02:34:30.087051Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig,ax =plt.subplots (figsize = (15,15))\nsns.heatmap(train.corr(),annot = True , cmap = 'YlGnBu', linewidths= 5 , ax=ax)","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:30.089514Z","iopub.execute_input":"2023-03-11T02:34:30.090111Z","iopub.status.idle":"2023-03-11T02:34:33.474323Z","shell.execute_reply.started":"2023-03-11T02:34:30.090075Z","shell.execute_reply":"2023-03-11T02:34:33.473177Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(5,5))\nplt.title('Correct_rate')\n(train_label['correct'].value_counts(normalize=True)*100).plot.pie(labels = [\"correct\", \"false\"], autopct='%1.1f%%')","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:33.475541Z","iopub.execute_input":"2023-03-11T02:34:33.475841Z","iopub.status.idle":"2023-03-11T02:34:33.588548Z","shell.execute_reply.started":"2023-03-11T02:34:33.475813Z","shell.execute_reply":"2023-03-11T02:34:33.587661Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"mean correct question from all the student who play this game was 70 % ","metadata":{}},{"cell_type":"code","source":"sns.barplot(x='page',y='index',data=X)","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:33.589965Z","iopub.execute_input":"2023-03-11T02:34:33.590507Z","iopub.status.idle":"2023-03-11T02:34:37.297528Z","shell.execute_reply.started":"2023-03-11T02:34:33.59047Z","shell.execute_reply":"2023-03-11T02:34:37.295248Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.barplot (x='name',y='index',data=X)","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:34:37.299134Z","iopub.execute_input":"2023-03-11T02:34:37.299455Z","iopub.status.idle":"2023-03-11T02:38:40.525214Z","shell.execute_reply.started":"2023-03-11T02:34:37.299427Z","shell.execute_reply":"2023-03-11T02:38:40.52407Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.barplot(x='name',y='index',data=test)","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:40.526832Z","iopub.execute_input":"2023-03-11T02:38:40.527136Z","iopub.status.idle":"2023-03-11T02:38:40.795727Z","shell.execute_reply.started":"2023-03-11T02:38:40.527104Z","shell.execute_reply":"2023-03-11T02:38:40.794816Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"from diagram we can see sample data from students doesnt care about their naem at the game ","metadata":{}},{"cell_type":"code","source":"sns.barplot(x='index',y='event_name',data=test)","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:40.797137Z","iopub.execute_input":"2023-03-11T02:38:40.797678Z","iopub.status.idle":"2023-03-11T02:38:41.250116Z","shell.execute_reply.started":"2023-03-11T02:38:40.797646Z","shell.execute_reply":"2023-03-11T02:38:41.24873Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"from prespective data many students back to checkpoint also students atrractive with map we can see the map click and map hover rate above 500 + ","metadata":{}},{"cell_type":"code","source":"sns.barplot(x='level',y='elapsed_time',data=test)\n","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:41.251627Z","iopub.execute_input":"2023-03-11T02:38:41.251929Z","iopub.status.idle":"2023-03-11T02:38:42.003406Z","shell.execute_reply.started":"2023-03-11T02:38:41.251901Z","shell.execute_reply":"2023-03-11T02:38:42.00207Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"- from the diagram we can see that the audience or player can complete lv 1 with shorten time and take more time to complete lv 19 ","metadata":{}},{"cell_type":"code","source":"score= train_label['correct'].sort_values( ascending=True)","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:42.004815Z","iopub.execute_input":"2023-03-11T02:38:42.005126Z","iopub.status.idle":"2023-03-11T02:38:42.017835Z","shell.execute_reply.started":"2023-03-11T02:38:42.005093Z","shell.execute_reply":"2023-03-11T02:38:42.016451Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = make_subplots(rows=1, cols=1)\nfig.append_trace(go.Bar(\n    x=test[\"level\"],\n    y=test[\"index\"],\n    name=\"trial and error\",\n), row=1, col=1)\nfig.update_layout(height=600, width=900, title_text=\"Trial and error at every level\")\nfig.update_layout(\npaper_bgcolor = \" #f2f2f2\",\nplot_bgcolor = \" yellowgreen\",\nfont=dict(family='sans-serif',\n                  color='black',\n                  size=10),)\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:42.021495Z","iopub.execute_input":"2023-03-11T02:38:42.02184Z","iopub.status.idle":"2023-03-11T02:38:42.385961Z","shell.execute_reply.started":"2023-03-11T02:38:42.021807Z","shell.execute_reply":"2023-03-11T02:38:42.384884Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"- from diagram we can see that the easyiest level that they can conquer at level 4 many player doesnt need trial and eror at this level but in other hand the hardest level was at lv 18 because many player try another chance for complete this level ","metadata":{}},{"cell_type":"code","source":"train_label","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:42.387503Z","iopub.execute_input":"2023-03-11T02:38:42.38802Z","iopub.status.idle":"2023-03-11T02:38:42.399649Z","shell.execute_reply.started":"2023-03-11T02:38:42.387993Z","shell.execute_reply":"2023-03-11T02:38:42.39846Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_label['question'] = train_label['session_id'].apply(lambda x: int(x.split('_')[1][1:]))\n","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:42.40123Z","iopub.execute_input":"2023-03-11T02:38:42.40156Z","iopub.status.idle":"2023-03-11T02:38:42.566044Z","shell.execute_reply.started":"2023-03-11T02:38:42.401531Z","shell.execute_reply":"2023-03-11T02:38:42.565086Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_label","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:42.567716Z","iopub.execute_input":"2023-03-11T02:38:42.56833Z","iopub.status.idle":"2023-03-11T02:38:42.580915Z","shell.execute_reply.started":"2023-03-11T02:38:42.568285Z","shell.execute_reply":"2023-03-11T02:38:42.579885Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mean_correct = train_label['correct'].sum()/212022","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:42.582253Z","iopub.execute_input":"2023-03-11T02:38:42.582591Z","iopub.status.idle":"2023-03-11T02:38:42.592668Z","shell.execute_reply.started":"2023-03-11T02:38:42.582558Z","shell.execute_reply":"2023-03-11T02:38:42.59184Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mean_correct","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:42.593902Z","iopub.execute_input":"2023-03-11T02:38:42.594739Z","iopub.status.idle":"2023-03-11T02:38:42.604854Z","shell.execute_reply.started":"2023-03-11T02:38:42.5947Z","shell.execute_reply":"2023-03-11T02:38:42.604159Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"- the avarage of student that answer the question was 70 % ","metadata":{}},{"cell_type":"code","source":"sns.barplot(x='question',y='correct', data=train_label)","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:42.605826Z","iopub.execute_input":"2023-03-11T02:38:42.606692Z","iopub.status.idle":"2023-03-11T02:38:45.273116Z","shell.execute_reply.started":"2023-03-11T02:38:42.606665Z","shell.execute_reply":"2023-03-11T02:38:45.271943Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"- from this diagram we can see that the question 13 was dificult for student because only 20 % STUDENT was correct at this question maybe if question number 13 must be include at the game for the tips we can replace to question 18 for the anticlimacs ","metadata":{}},{"cell_type":"code","source":"train['text']","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:45.274703Z","iopub.execute_input":"2023-03-11T02:38:45.27502Z","iopub.status.idle":"2023-03-11T02:38:45.282218Z","shell.execute_reply.started":"2023-03-11T02:38:45.274988Z","shell.execute_reply":"2023-03-11T02:38:45.28145Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.feature_extraction.text import CountVectorizer","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:45.283184Z","iopub.execute_input":"2023-03-11T02:38:45.284371Z","iopub.status.idle":"2023-03-11T02:38:45.43118Z","shell.execute_reply.started":"2023-03-11T02:38:45.284334Z","shell.execute_reply":"2023-03-11T02:38:45.429838Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"word_sample = ['fun learn fun ' , 'car do all day' , 'hate feel ']\nvect = CountVectorizer()\nvect.fit(word_sample)","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:45.432497Z","iopub.execute_input":"2023-03-11T02:38:45.432799Z","iopub.status.idle":"2023-03-11T02:38:45.449486Z","shell.execute_reply.started":"2023-03-11T02:38:45.432771Z","shell.execute_reply":"2023-03-11T02:38:45.447766Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.feature_extraction.text import TfidfVectorizer","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:45.451083Z","iopub.execute_input":"2023-03-11T02:38:45.451435Z","iopub.status.idle":"2023-03-11T02:38:45.456306Z","shell.execute_reply.started":"2023-03-11T02:38:45.451375Z","shell.execute_reply":"2023-03-11T02:38:45.455238Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def kamus(check):\n    check = check.str.extractall('([a-zA_Z]+)')\n    check.columns = ['check']\n    b = check.reset_index(drop=True)\n    check = b['check'].value_counts()\n\n    kamus = {'word':check.index,'freq':check.values}\n    kamus = pd.DataFrame(kamus)\n    kamus.index = kamus['word']\n    kamus.drop('word', axis = 1, inplace = True)\n    kamus.sort_values('freq',ascending=False,inplace=True)\n    \n    return kamus","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:45.457308Z","iopub.execute_input":"2023-03-11T02:38:45.457667Z","iopub.status.idle":"2023-03-11T02:38:45.469309Z","shell.execute_reply.started":"2023-03-11T02:38:45.457631Z","shell.execute_reply":"2023-03-11T02:38:45.467367Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train['text']","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:45.470914Z","iopub.execute_input":"2023-03-11T02:38:45.471244Z","iopub.status.idle":"2023-03-11T02:38:45.485052Z","shell.execute_reply.started":"2023-03-11T02:38:45.471214Z","shell.execute_reply":"2023-03-11T02:38:45.484078Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_kamus = kamus(test['text'])","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:45.486546Z","iopub.execute_input":"2023-03-11T02:38:45.486868Z","iopub.status.idle":"2023-03-11T02:38:45.519362Z","shell.execute_reply.started":"2023-03-11T02:38:45.48683Z","shell.execute_reply":"2023-03-11T02:38:45.517886Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_kamus[:20].plot(kind='barh')","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:45.520634Z","iopub.execute_input":"2023-03-11T02:38:45.520876Z","iopub.status.idle":"2023-03-11T02:38:45.774468Z","shell.execute_reply.started":"2023-03-11T02:38:45.52085Z","shell.execute_reply":"2023-03-11T02:38:45.773375Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# there was frequens from students chat by text at sample ","metadata":{}},{"cell_type":"code","source":"\n\ndef plot_cloud(wordcloud):\n    # Set figure size\n    plt.figure(figsize=(20, 10))\n    # Display image\n    plt.imshow(wordcloud) \n    # No axis details\n    plt.axis(\"off\")","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:45.776336Z","iopub.execute_input":"2023-03-11T02:38:45.776769Z","iopub.status.idle":"2023-03-11T02:38:45.783063Z","shell.execute_reply.started":"2023-03-11T02:38:45.776731Z","shell.execute_reply":"2023-03-11T02:38:45.781687Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from wordcloud import WordCloud","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:45.784688Z","iopub.execute_input":"2023-03-11T02:38:45.785033Z","iopub.status.idle":"2023-03-11T02:38:45.819605Z","shell.execute_reply.started":"2023-03-11T02:38:45.784991Z","shell.execute_reply":"2023-03-11T02:38:45.818403Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"word_cloud = WordCloud().generate(str(test['text']))\nplot_cloud(word_cloud)","metadata":{"execution":{"iopub.status.busy":"2023-03-11T02:38:45.822348Z","iopub.execute_input":"2023-03-11T02:38:45.823511Z","iopub.status.idle":"2023-03-11T02:38:46.06668Z","shell.execute_reply.started":"2023-03-11T02:38:45.823463Z","shell.execute_reply":"2023-03-11T02:38:46.065332Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"-from the immage the bigger text was the most frequens at sample test students text at the game","metadata":{}}]}