{"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":"# Meaning of Each Event Name\n\nUnderstanting the various event names is very important for this competition and I couldn't find any notebook or discussion which explains them in enough detail. So in this notebook I've tried my best to describe, clarify and analyze all the important event names according to my understanding using examples from the data and in-game images.","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.axes_grid1 import ImageGrid\nimport os\nfrom PIL import Image\n\nplt.show()\n\ndtypes={'session_id':'int', \n'elapsed_time':np.int32,\n    'event_name':'category',\n    'name':'category',\n    'level':np.int32,\n    'page':'category',\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'}\n\ntrain = pd.read_csv('/kaggle/input/predict-student-performance-from-game-play/train.csv', dtype=dtypes)","metadata":{"execution":{"iopub.status.busy":"2023-03-01T09:38:59.005178Z","iopub.execute_input":"2023-03-01T09:38:59.005591Z","iopub.status.idle":"2023-03-01T09:40:29.424934Z","shell.execute_reply.started":"2023-03-01T09:38:59.005554Z","shell.execute_reply":"2023-03-01T09:40:29.423829Z"},"_kg_hide-input":true,"_kg_hide-output":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print()\nprint('The Most Important Event Names in the data are:')\nprint()\nfor i,j in enumerate(['navigate_click','observation_click','notification_click',\n 'object_click','object_hover','map_hover','map_click','notebook_click','checkpoint']):\n    print(f'{i+1}.', j)","metadata":{"execution":{"iopub.status.busy":"2023-03-01T09:40:48.738186Z","iopub.execute_input":"2023-03-01T09:40:48.739684Z","iopub.status.idle":"2023-03-01T09:40:48.748493Z","shell.execute_reply.started":"2023-03-01T09:40:48.739614Z","shell.execute_reply":"2023-03-01T09:40:48.747323Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"So let's start!!!","metadata":{}},{"cell_type":"markdown","source":"# 1. navigate_click\n\nTo move Jo, we click on the place we want her to move to in the room. This is a navigate_click.","metadata":{}},{"cell_type":"code","source":"images = os.listdir('../input/event-names/navigate_click1')\nimages.sort()\nimg_arr = []\n\ndef img_reshape(img):\n    img = Image.open('../input/event-names/navigate_click1/'+img).convert('RGB')\n    img = img.resize((1000,800))\n    img = np.asarray(img)\n    return img\n\nfor image in images:\n    img_arr.append(img_reshape(image))\n\nfig = plt.figure(figsize=(20., 20.))\ngrid = ImageGrid(fig, 111, \n                 nrows_ncols=(1, 3),  # creates 2x2 grid of axes\n                 axes_pad=0.1,  # pad between axes\n                 )\n\nfor ax, im in zip(grid, img_arr):\n    ax.imshow(im)\n    ax.get_xaxis().set_visible(False)\n    ax.get_yaxis().set_visible(False)","metadata":{"execution":{"iopub.status.busy":"2023-03-01T09:55:28.222644Z","iopub.execute_input":"2023-03-01T09:55:28.223348Z","iopub.status.idle":"2023-03-01T09:55:29.545675Z","shell.execute_reply.started":"2023-03-01T09:55:28.223299Z","shell.execute_reply":"2023-03-01T09:55:29.544580Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Moreover, there are some observations, objects, people, entrances, exits in the game like photos on the wall, teddy, the notebook, the retirement letter, grampa, boss, wells, just to name a few. If you take your mouse pointer near them, a black object appears on top of them as shown in the images below. Clicking on this black object is also a navigate click.","metadata":{}},{"cell_type":"code","source":"images = os.listdir('../input/event-names/navigate click2')\nimages.sort()\nimg_arr = []\n\ndef img_reshape(img):\n    img = Image.open('../input/event-names/navigate click2/'+img).convert('RGB')\n    img = img.resize((1000,800))\n    img = np.asarray(img)\n    return img\n\nfor image in images:\n    img_arr.append(img_reshape(image))\n\nfig = plt.figure(figsize=(20., 20.))\ngrid = ImageGrid(fig, 111, \n                 nrows_ncols=(2, 3),  # creates 2x2 grid of axes\n                 axes_pad=0.1,  # pad between axes\n                 )\n\nfor ax, im in zip(grid, img_arr):\n    ax.imshow(im)\n    ax.get_xaxis().set_visible(False)\n    ax.get_yaxis().set_visible(False)","metadata":{"execution":{"iopub.status.busy":"2023-03-01T09:55:08.582089Z","iopub.execute_input":"2023-03-01T09:55:08.582591Z","iopub.status.idle":"2023-03-01T09:55:11.379456Z","shell.execute_reply.started":"2023-03-01T09:55:08.582548Z","shell.execute_reply":"2023-03-01T09:55:11.378322Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('Example of a navigate_click on the notebook:')\nprint()\ntrain.iloc[25:27,[0,3,4,12,13]]","metadata":{"execution":{"iopub.status.busy":"2023-03-01T08:59:22.147165Z","iopub.execute_input":"2023-03-01T08:59:22.147610Z","iopub.status.idle":"2023-03-01T08:59:22.209950Z","shell.execute_reply.started":"2023-03-01T08:59:22.147573Z","shell.execute_reply":"2023-03-01T08:59:22.208796Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 2. observation_click\n\nThere are some observations in the game like, the photos on the wall, archivist's room when he is not there, etc. If you navigate_click on the black object that appears when you take your mouse pointer close to them as dicsussed in the previous point, a text appears near to the observation. The click you make just after the text appears is an observation_click. This click hides the text (It can be anywhere on the screen).","metadata":{}},{"cell_type":"code","source":"images = os.listdir('../input/event-names/observation_click')\nimages.sort()\nimg_arr = []\n\ndef img_reshape(img):\n    img = Image.open('../input/event-names/observation_click/'+img).convert('RGB')\n    img = img.resize((1000,800))\n    img = np.asarray(img)\n    return img\n\nfor image in images:\n    img_arr.append(img_reshape(image))\n\nfig = plt.figure(figsize=(20., 20.))\ngrid = ImageGrid(fig, 111, \n                 nrows_ncols=(1, 3),  # creates 2x2 grid of axes\n                 axes_pad=0.1,  # pad between axes\n                 )\n\nfor ax, im in zip(grid, img_arr):\n    ax.imshow(im)\n    ax.get_xaxis().set_visible(False)\n    ax.get_yaxis().set_visible(False)","metadata":{"execution":{"iopub.status.busy":"2023-03-01T09:55:58.788277Z","iopub.execute_input":"2023-03-01T09:55:58.788756Z","iopub.status.idle":"2023-03-01T09:56:00.309109Z","shell.execute_reply.started":"2023-03-01T09:55:58.788716Z","shell.execute_reply":"2023-03-01T09:56:00.308051Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('Example of an observation_click:')\nprint()\ntrain.iloc[36:38,[0,3,4,12,13]]","metadata":{"execution":{"iopub.status.busy":"2023-03-01T08:59:22.212770Z","iopub.execute_input":"2023-03-01T08:59:22.213186Z","iopub.status.idle":"2023-03-01T08:59:22.229758Z","shell.execute_reply.started":"2023-03-01T08:59:22.213147Z","shell.execute_reply":"2023-03-01T08:59:22.228301Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Note that text also appears when you click on a person like gramps, boss, wells, teddy, etc, but the click after these texts appear is not an observation click. It's either a person_click or a cutscene_click. \n\nAlso, if clicking on the object leads to a conversation between two or more characters, then the clicks to continue the conversation are cutscene_clicks. Ex. Clicking on trigger_coffee, trigger_scarf, etc.","metadata":{}},{"cell_type":"markdown","source":"# 3. notification_click\n\nIf you navigate click on an object like the notebook, the retirement letter, the slip on the shirt, etc, the object pops up and a text appears at the bottom of the object. The click after the text appears, to hide or to continue is a notification_click. The click can be anywhere on the screen. ","metadata":{}},{"cell_type":"code","source":"images = os.listdir('../input/event-names/notification click')\nimages.sort()\nimg_arr = []\n\ndef img_reshape(img):\n    img = Image.open('../input/event-names/notification click/'+img).convert('RGB')\n    img = img.resize((1000,800))\n    img = np.asarray(img)\n    return img\n\nfor image in images:\n    img_arr.append(img_reshape(image))\n\nfig = plt.figure(figsize=(20., 20.))\ngrid = ImageGrid(fig, 111, \n                 nrows_ncols=(1, 4),  # creates 2x2 grid of axes\n                 axes_pad=0.1,  # pad between axes\n                 )\n\nfor ax, im in zip(grid, img_arr):\n    ax.imshow(im)\n    ax.get_xaxis().set_visible(False)\n    ax.get_yaxis().set_visible(False)","metadata":{"execution":{"iopub.status.busy":"2023-03-01T09:56:54.909944Z","iopub.execute_input":"2023-03-01T09:56:54.910433Z","iopub.status.idle":"2023-03-01T09:56:56.611204Z","shell.execute_reply.started":"2023-03-01T09:56:54.910390Z","shell.execute_reply":"2023-03-01T09:56:56.610267Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('Examples of notification_click:')\nprint()\ntrain.iloc[84:87,[0,3,4,12,13]]","metadata":{"execution":{"iopub.status.busy":"2023-03-01T08:59:22.231458Z","iopub.execute_input":"2023-03-01T08:59:22.231853Z","iopub.status.idle":"2023-03-01T08:59:22.248211Z","shell.execute_reply.started":"2023-03-01T08:59:22.231815Z","shell.execute_reply":"2023-03-01T08:59:22.247050Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 4. object_click\nAs discussed in the previous point, whenever you navigate_click on an object, it pops up, and if a text appears, then the clicks to hide or continue the text are notification_clicks. But after that, any click anywhere on the object pop up or a click on the cross to close the object pop up is an object_click.\n\nNote that some objects don't display any text when clicked, so there are no notification_clicks associated with them.","metadata":{}},{"cell_type":"markdown","source":"# 5. object_hover\n\nSome tasks have to be performed in the game, like clicking the slip on the t-shirt in the 1st Chapter of the game, etc. Also, to complete these tasks, sometimes we have to click on next or previous buttons like to find the year 1916 on the businesscards in Chapter 2. If we take the mouse pointer above the main object or next/previous buttons, our mouse pointer's design changes as in the images below and hover duration starts getting recorded. When we take the pointer away from there, the recording stops and an object_hover entry is made with the hover_duration. \n\nNote: When the student clicks the main object or next/previous buttons, an object_click entry is also made.","metadata":{}},{"cell_type":"code","source":"images = os.listdir('../input/event-names/object_hover')\nimages.sort()\nimg_arr = []\n\ndef img_reshape(img):\n    img = Image.open('../input/event-names/object_hover/'+img).convert('RGB')\n    img = img.resize((1000,800))\n    img = np.asarray(img)\n    return img\n\nfor image in images:\n    img_arr.append(img_reshape(image))\n\nfig = plt.figure(figsize=(20., 20.))\ngrid = ImageGrid(fig, 111, \n                 nrows_ncols=(1, 3),  # creates 2x2 grid of axes\n                 axes_pad=0.1,  # pad between axes\n                 )\n\nfor ax, im in zip(grid, img_arr):\n    ax.imshow(im)\n    ax.get_xaxis().set_visible(False)\n    ax.get_yaxis().set_visible(False)","metadata":{"execution":{"iopub.status.busy":"2023-03-01T09:57:42.790461Z","iopub.execute_input":"2023-03-01T09:57:42.790952Z","iopub.status.idle":"2023-03-01T09:57:44.045921Z","shell.execute_reply.started":"2023-03-01T09:57:42.790911Z","shell.execute_reply":"2023-03-01T09:57:44.044813Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('Examples of object_hover on the businesscards:')\nprint()\ntrain.iloc[292:303,[0,3,4,11,13]]","metadata":{"execution":{"iopub.status.busy":"2023-03-01T08:59:22.249959Z","iopub.execute_input":"2023-03-01T08:59:22.250309Z","iopub.status.idle":"2023-03-01T08:59:22.268328Z","shell.execute_reply.started":"2023-03-01T08:59:22.250278Z","shell.execute_reply":"2023-03-01T08:59:22.267245Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 6. map_hover\n\nThere is a map in the game too! There are many places on the map a student can click on to go there. Just like object_hover, when he/she takes the pointer above any place in the map, hover duration starts getting recorded. When he/she takes the pointer away from the place clicks on it, the recording stops and a map_hover entry is made with the hover_duration. The mouse pointer design changes here too.\n","metadata":{}},{"cell_type":"code","source":"images = os.listdir('../input/event-names/map_hover')\nimages.sort()\nimg_arr = []\n\ndef img_reshape(img):\n    img = Image.open('../input/event-names/map_hover/'+img).convert('RGB')\n    img = img.resize((1000,800))\n    img = np.asarray(img)\n    return img\n\nfor image in images:\n    img_arr.append(img_reshape(image))\n\nfig = plt.figure(figsize=(7., 7.))\ngrid = ImageGrid(fig, 111, \n                 nrows_ncols=(1, 1),  # creates 2x2 grid of axes\n                 axes_pad=0.1,  # pad between axes\n                 )\n\nfor ax, im in zip(grid, img_arr):\n    ax.imshow(im)\n    ax.get_xaxis().set_visible(False)\n    ax.get_yaxis().set_visible(False)","metadata":{"execution":{"iopub.status.busy":"2023-03-01T09:59:02.953194Z","iopub.execute_input":"2023-03-01T09:59:02.953618Z","iopub.status.idle":"2023-03-01T09:59:03.516162Z","shell.execute_reply.started":"2023-03-01T09:59:02.953581Z","shell.execute_reply":"2023-03-01T09:59:03.515069Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('Examples of map_hover:')\nprint()\ntrain.iloc[667:671,[0,3,4,11,13]]","metadata":{"execution":{"iopub.status.busy":"2023-03-01T08:59:22.269938Z","iopub.execute_input":"2023-03-01T08:59:22.270306Z","iopub.status.idle":"2023-03-01T08:59:22.286710Z","shell.execute_reply.started":"2023-03-01T08:59:22.270273Z","shell.execute_reply":"2023-03-01T08:59:22.285402Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 7. map_click\n\nWhen the student click on a place on the map to go there, it's a map_click!","metadata":{}},{"cell_type":"markdown","source":"# 8. notebook_click\n\nAfter we've found the notebook during the opening scenes of the game, the notebook stays at the bottom left corner of the screen for the entire duration of the game. Whenever we want, we can can click on it to look for notes made by Jo. Clicking on the notebook to open it, clicking on any page of the notebook, clicking on next or previous button and closing the notebook, all are notebook_clicks.","metadata":{}},{"cell_type":"code","source":"images = os.listdir('../input/event-names/notebook_click')\nimages.sort()\nimg_arr = []\n\ndef img_reshape(img):\n    img = Image.open('../input/event-names/notebook_click/'+img).convert('RGB')\n    img = img.resize((1000,800))\n    img = np.asarray(img)\n    return img\n\nfor image in images:\n    img_arr.append(img_reshape(image))\n\nfig = plt.figure(figsize=(20., 20.))\ngrid = ImageGrid(fig, 111, \n                 nrows_ncols=(1, 3),  # creates 2x2 grid of axes\n                 axes_pad=0.1,  # pad between axes\n                 )\n\nfor ax, im in zip(grid, img_arr):\n    ax.imshow(im)\n    ax.get_xaxis().set_visible(False)\n    ax.get_yaxis().set_visible(False)","metadata":{"execution":{"iopub.status.busy":"2023-03-01T09:59:25.116839Z","iopub.execute_input":"2023-03-01T09:59:25.117890Z","iopub.status.idle":"2023-03-01T09:59:26.719746Z","shell.execute_reply.started":"2023-03-01T09:59:25.117829Z","shell.execute_reply":"2023-03-01T09:59:26.716443Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('Examples of notebook_click:')\nprint()\ntrain.iloc[2224:2234,[0,3,4]]","metadata":{"execution":{"iopub.status.busy":"2023-03-01T08:59:22.288503Z","iopub.execute_input":"2023-03-01T08:59:22.288854Z","iopub.status.idle":"2023-03-01T08:59:22.302456Z","shell.execute_reply.started":"2023-03-01T08:59:22.288820Z","shell.execute_reply":"2023-03-01T08:59:22.301347Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 9. checkpoint\n\nCheckpoint is the last event of a level-group/chapter in the data. The questions that we have to predict are asked after this point in the game.","metadata":{}},{"cell_type":"code","source":"print('Examples of checkpoint:')\nprint()\ntrain.iloc[[164,460,880],[0,3,4,5,-1]]","metadata":{"execution":{"iopub.status.busy":"2023-03-01T08:59:22.304320Z","iopub.execute_input":"2023-03-01T08:59:22.305087Z","iopub.status.idle":"2023-03-01T08:59:22.353861Z","shell.execute_reply.started":"2023-03-01T08:59:22.305011Z","shell.execute_reply":"2023-03-01T08:59:22.352715Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Thank you for reading the notebook ;)\n\nI hope it helped you in some way.\nIf you have any question, please feel free to ask me. ","metadata":{}}]}