{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"markdown","source":"# Let's bring in the imports and the data"},{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":true},"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nplt.style.use('ggplot')\nimport seaborn as sns\nsns.set_style('dark')\nimport sklearn\nimport tensorflow as tf\nfrom tensorflow import keras","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"read_num = 10 ** 6\n\ntrain = pd.read_csv('/kaggle/input/riiid-test-answer-prediction/train.csv', low_memory=False, nrows=read_num, \n                       dtype={'row_id': 'int64', 'timestamp': 'int64', 'user_id': 'int32', 'content_id': 'int16', 'content_type_id': 'int8',\n                              'task_container_id': 'int16', 'user_answer': 'int8', 'answered_correctly': 'int8', 'prior_question_elapsed_time': 'float32', \n                             'prior_question_had_explanation': 'boolean',})","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.shape","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Data Analysis"},{"metadata":{"trusted":true},"cell_type":"code","source":"train.columns","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.describe()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.isnull().sum()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## 1. Timestamp"},{"metadata":{"trusted":true},"cell_type":"code","source":"train.groupby('answered_correctly').mean()['timestamp'].plot(kind='bar')\nplt.ylabel('Mean timestamp')\nplt.tight_layout()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"sns.distplot(np.log1p(train['timestamp']), bins=40, kde=True)\nplt.title('Distribution of timestamp values')\nplt.tight_layout()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## 2. User Id"},{"metadata":{"trusted":true},"cell_type":"code","source":"train['user_id'].unique().sum()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"user_id_grp = train.groupby('user_id')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"temp = user_id_grp['answered_correctly'].agg('count')\ntemp = dict(temp)\nprint('Minimum number of interactions from a single user', min(temp.values()))\nprint('Maximum number of interactions from a single user', max(temp.values()))","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## 3. Content Type Id"},{"metadata":{"trusted":true},"cell_type":"code","source":"train['content_type_id'].value_counts()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.groupby('content_type_id').count()['row_id'].plot(kind='bar')\nplt.yscale('log')\nplt.tight_layout()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## 4. Task container id "},{"metadata":{"trusted":true},"cell_type":"code","source":"train['task_container_id'].unique().sum()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## 5. Answered Correctly"},{"metadata":{"trusted":true},"cell_type":"code","source":"train.groupby('answered_correctly').count()['row_id'].plot(kind='bar')\nplt.ylabel('Number of answers')\nplt.tight_layout()","execution_count":null,"outputs":[]}],"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":4,"nbformat_minor":4}