{"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)\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","trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Import Libraries","metadata":{}},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport os\nimport matplotlib.pyplot as plt\nimport seaborn as sns","metadata":{"execution":{"iopub.status.busy":"2023-06-29T08:36:00.751221Z","iopub.execute_input":"2023-06-29T08:36:00.751607Z","iopub.status.idle":"2023-06-29T08:36:01.532210Z","shell.execute_reply.started":"2023-06-29T08:36:00.751577Z","shell.execute_reply":"2023-06-29T08:36:01.531039Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#load the testdata set into testData dataframe\ntestData = pd.read_csv('/kaggle/input/predict-student-performance-from-game-play/test.csv')","metadata":{"execution":{"iopub.status.busy":"2023-06-29T08:36:06.684726Z","iopub.execute_input":"2023-06-29T08:36:06.685156Z","iopub.status.idle":"2023-06-29T08:36:06.732785Z","shell.execute_reply.started":"2023-06-29T08:36:06.685122Z","shell.execute_reply":"2023-06-29T08:36:06.731694Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#first 5 data\ntestData.head(5)","metadata":{"execution":{"iopub.status.busy":"2023-06-29T06:22:31.813089Z","iopub.execute_input":"2023-06-29T06:22:31.813473Z","iopub.status.idle":"2023-06-29T06:22:31.837112Z","shell.execute_reply.started":"2023-06-29T06:22:31.813446Z","shell.execute_reply":"2023-06-29T06:22:31.836042Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"testData.size","metadata":{"execution":{"iopub.status.busy":"2023-06-29T06:22:39.291181Z","iopub.execute_input":"2023-06-29T06:22:39.291559Z","iopub.status.idle":"2023-06-29T06:22:39.297422Z","shell.execute_reply.started":"2023-06-29T06:22:39.291528Z","shell.execute_reply":"2023-06-29T06:22:39.296687Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#number of rows and columns\ntestData.shape","metadata":{"execution":{"iopub.status.busy":"2023-06-29T06:23:07.251135Z","iopub.execute_input":"2023-06-29T06:23:07.251494Z","iopub.status.idle":"2023-06-29T06:23:07.257547Z","shell.execute_reply.started":"2023-06-29T06:23:07.251467Z","shell.execute_reply":"2023-06-29T06:23:07.256675Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"testData.info()","metadata":{"execution":{"iopub.status.busy":"2023-06-29T06:23:39.845353Z","iopub.execute_input":"2023-06-29T06:23:39.845741Z","iopub.status.idle":"2023-06-29T06:23:39.873647Z","shell.execute_reply.started":"2023-06-29T06:23:39.845711Z","shell.execute_reply":"2023-06-29T06:23:39.872843Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#summarize statistically\ntestData.describe()","metadata":{"execution":{"iopub.status.busy":"2023-06-29T06:23:57.971522Z","iopub.execute_input":"2023-06-29T06:23:57.971909Z","iopub.status.idle":"2023-06-29T06:23:58.036395Z","shell.execute_reply.started":"2023-06-29T06:23:57.971881Z","shell.execute_reply":"2023-06-29T06:23:58.035359Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"testData.describe(include= 'all')","metadata":{"execution":{"iopub.status.busy":"2023-06-29T06:24:23.643737Z","iopub.execute_input":"2023-06-29T06:24:23.644130Z","iopub.status.idle":"2023-06-29T06:24:23.733835Z","shell.execute_reply.started":"2023-06-29T06:24:23.644087Z","shell.execute_reply":"2023-06-29T06:24:23.732943Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"testData.dtypes","metadata":{"execution":{"iopub.status.busy":"2023-06-29T06:26:15.373725Z","iopub.execute_input":"2023-06-29T06:26:15.374106Z","iopub.status.idle":"2023-06-29T06:26:15.384023Z","shell.execute_reply.started":"2023-06-29T06:26:15.374077Z","shell.execute_reply":"2023-06-29T06:26:15.382861Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#check duplicates\ntestData.duplicated()","metadata":{"execution":{"iopub.status.busy":"2023-06-29T06:26:22.331450Z","iopub.execute_input":"2023-06-29T06:26:22.331843Z","iopub.status.idle":"2023-06-29T06:26:22.350205Z","shell.execute_reply.started":"2023-06-29T06:26:22.331808Z","shell.execute_reply":"2023-06-29T06:26:22.349380Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Check null values\ntestData.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-06-29T06:25:17.644451Z","iopub.execute_input":"2023-06-29T06:25:17.645388Z","iopub.status.idle":"2023-06-29T06:25:17.662797Z","shell.execute_reply.started":"2023-06-29T06:25:17.645351Z","shell.execute_reply":"2023-06-29T06:25:17.661828Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"There are null-values for attributes.\n\n- page              -  3575\n- room_coor_x       -   362\n- room_coor_y       -   362\n- screen_coor_x     -   362\n- screen_coor_y     -   362\n- hover_duration    -  3375\n- text              -  2566\n- fqid              -  1223\n- text_fqid         -  2566","metadata":{}},{"cell_type":"markdown","source":"# Visualize heatmap for detecting null values","metadata":{}},{"cell_type":"code","source":"plt.subplots(figsize=(10,10))\nsns.heatmap(testData.isnull(), yticklabels=False, cbar=False)","metadata":{"execution":{"iopub.status.busy":"2023-06-29T06:28:43.094192Z","iopub.execute_input":"2023-06-29T06:28:43.094561Z","iopub.status.idle":"2023-06-29T06:28:43.544734Z","shell.execute_reply.started":"2023-06-29T06:28:43.094534Z","shell.execute_reply":"2023-06-29T06:28:43.543963Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#drop session_id \ntestData = testData.drop(columns = ['session_id'])","metadata":{"execution":{"iopub.status.busy":"2023-06-29T08:36:17.747532Z","iopub.execute_input":"2023-06-29T08:36:17.747974Z","iopub.status.idle":"2023-06-29T08:36:17.765397Z","shell.execute_reply.started":"2023-06-29T08:36:17.747923Z","shell.execute_reply":"2023-06-29T08:36:17.764165Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#check correlation between attributes\ntest_corr = testData.corr()\ntest_corr","metadata":{"execution":{"iopub.status.busy":"2023-06-29T06:41:33.604398Z","iopub.execute_input":"2023-06-29T06:41:33.604790Z","iopub.status.idle":"2023-06-29T06:41:33.630951Z","shell.execute_reply.started":"2023-06-29T06:41:33.604760Z","shell.execute_reply":"2023-06-29T06:41:33.630183Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#visualize the correlations before dropping attributes with null-values\nsns.heatmap(test_corr, annot = True)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-06-29T06:41:39.451290Z","iopub.execute_input":"2023-06-29T06:41:39.451663Z","iopub.status.idle":"2023-06-29T06:41:40.052358Z","shell.execute_reply.started":"2023-06-29T06:41:39.451635Z","shell.execute_reply":"2023-06-29T06:41:40.051525Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#drop attributes with null-values\ntestData.drop(['page', 'hover_duration', 'text', 'text_fqid', 'fqid','room_coor_x','room_coor_y','screen_coor_x','screen_coor_y'], axis=1, inplace=True)","metadata":{"execution":{"iopub.status.busy":"2023-06-29T08:36:23.080724Z","iopub.execute_input":"2023-06-29T08:36:23.081183Z","iopub.status.idle":"2023-06-29T08:36:23.089356Z","shell.execute_reply.started":"2023-06-29T08:36:23.081149Z","shell.execute_reply":"2023-06-29T08:36:23.088023Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#visualize heatmap after dropping \nplt.subplots(figsize=(10,10))\nsns.heatmap(testData.isnull(), yticklabels=False, cbar=False)","metadata":{"execution":{"iopub.status.busy":"2023-06-29T08:36:25.240528Z","iopub.execute_input":"2023-06-29T08:36:25.240961Z","iopub.status.idle":"2023-06-29T08:36:25.589483Z","shell.execute_reply.started":"2023-06-29T08:36:25.240897Z","shell.execute_reply":"2023-06-29T08:36:25.588412Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"testData.info()","metadata":{"execution":{"iopub.status.busy":"2023-06-29T08:36:58.267299Z","iopub.execute_input":"2023-06-29T08:36:58.267724Z","iopub.status.idle":"2023-06-29T08:36:58.293906Z","shell.execute_reply.started":"2023-06-29T08:36:58.267693Z","shell.execute_reply":"2023-06-29T08:36:58.292895Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"testData.head(5)","metadata":{"execution":{"iopub.status.busy":"2023-06-29T08:38:51.182210Z","iopub.execute_input":"2023-06-29T08:38:51.182639Z","iopub.status.idle":"2023-06-29T08:38:51.214110Z","shell.execute_reply.started":"2023-06-29T08:38:51.182607Z","shell.execute_reply":"2023-06-29T08:38:51.213108Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#view the statistical properties of character variables\ntestData.describe(include=['object'])","metadata":{"execution":{"iopub.status.busy":"2023-06-29T08:41:38.602122Z","iopub.execute_input":"2023-06-29T08:41:38.603298Z","iopub.status.idle":"2023-06-29T08:41:38.635056Z","shell.execute_reply.started":"2023-06-29T08:41:38.603251Z","shell.execute_reply":"2023-06-29T08:41:38.633687Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"testData['event_name'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-06-29T08:54:46.638672Z","iopub.execute_input":"2023-06-29T08:54:46.639224Z","iopub.status.idle":"2023-06-29T08:54:46.650191Z","shell.execute_reply.started":"2023-06-29T08:54:46.639188Z","shell.execute_reply":"2023-06-29T08:54:46.649058Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x = testData['event_name'].value_counts().unique()\ny = testData['event_name'].unique()\nplt.barh(y, x)\n \n# setting label of y-axis\nplt.ylabel(\"event name\")\n \n# setting label of x-axis\nplt.xlabel(\"frequency\")\nplt.title(\"Distribution of event_name\")\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-06-29T09:03:18.249553Z","iopub.execute_input":"2023-06-29T09:03:18.252408Z","iopub.status.idle":"2023-06-29T09:03:18.605749Z","shell.execute_reply.started":"2023-06-29T09:03:18.252362Z","shell.execute_reply":"2023-06-29T09:03:18.604786Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"testData['room_fqid'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-06-29T09:04:29.243446Z","iopub.execute_input":"2023-06-29T09:04:29.243867Z","iopub.status.idle":"2023-06-29T09:04:29.255084Z","shell.execute_reply.started":"2023-06-29T09:04:29.243838Z","shell.execute_reply":"2023-06-29T09:04:29.254181Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x = testData['room_fqid'].value_counts().unique()\ny = testData['room_fqid'].unique()\nplt.barh(y, x)\n \n# setting label of y-axis\nplt.ylabel(\"room_fqid\")\n \n# setting label of x-axis\nplt.xlabel(\"frequency\")\nplt.title(\"Distribution of room_fqid\")\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-06-29T09:05:20.205840Z","iopub.execute_input":"2023-06-29T09:05:20.206341Z","iopub.status.idle":"2023-06-29T09:05:20.634403Z","shell.execute_reply.started":"2023-06-29T09:05:20.206306Z","shell.execute_reply":"2023-06-29T09:05:20.633349Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.countplot(x= testData['name'], data=testData)","metadata":{"execution":{"iopub.status.busy":"2023-06-29T08:50:54.283803Z","iopub.execute_input":"2023-06-29T08:50:54.284326Z","iopub.status.idle":"2023-06-29T08:50:54.530111Z","shell.execute_reply.started":"2023-06-29T08:50:54.284292Z","shell.execute_reply":"2023-06-29T08:50:54.529247Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.countplot(x= testData['level_group'], data=testData)","metadata":{"execution":{"iopub.status.busy":"2023-06-29T09:08:03.435472Z","iopub.execute_input":"2023-06-29T09:08:03.435999Z","iopub.status.idle":"2023-06-29T09:08:03.662120Z","shell.execute_reply.started":"2023-06-29T09:08:03.435962Z","shell.execute_reply":"2023-06-29T09:08:03.661155Z"},"trusted":true},"execution_count":null,"outputs":[]}]}