{"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":"<center>\n    <a href=\"#\"><img class=\"col-img3\" src=\"https://www.rochester.edu/newscenter/wp-content/uploads/2014/11/fea-video-gam-controller.jpg\" alt=\"\"><p class=\"col-text\"></p></a>\n</center>","metadata":{"papermill":{"duration":0.007624,"end_time":"2023-02-04T14:41:18.922546","exception":false,"start_time":"2023-02-04T14:41:18.914922","status":"completed"},"tags":[]}},{"cell_type":"markdown","source":"\n<h1 style=\"background-color:#8000ff;font-family:newtimeroman;font-size:350%;text-align:center;border-radius: 15px 50px;\">📋 Table of Content</h1>\n\n<div style=\"border-radius:10px;\n            border :#0A0104 solid;\n            padding: 15px;\n            background-color:  ;\n           font-size:110%;\n            text-align: left\">\n    <a id=\"table\"></a>\n    <center>\n        > <a href=\"#1\"> 📌 Objectives of Notebook</a>\n        <br>\n        > <a href=\"#8\"> 📈 Interesting chartsms</a>\n        <br>\n        > <a href=\"#9\"> 💻 Example Dataloader</a>\n        <br>\n        > <a href=\"#6\"> 📥 LOADING DATASET</a>\n        <br>\n        > <a href=\"#4\"> 📚 Importing Libraries</a>\n        <br>\n        > <a href=\"#3\"> 📖 Basic concepts</a>\n        <br>\n        > <a href=\"#7\"> 🧹 Data Cleaning</a>\n        <br>\n        > <a href=\"#5\"> ⚙️ CONFIG</a>\n        <br>\n        > <a href=\"#2\"> 🎯 Goals</a>\n        <br>\n    </center>\n</div>\n","metadata":{"papermill":{"duration":0.005612,"end_time":"2023-02-04T14:41:18.934864","exception":false,"start_time":"2023-02-04T14:41:18.929252","status":"completed"},"tags":[]}},{"cell_type":"markdown","source":"## <div style=\"padding:10px;background-color:#8000ff;margin:0;color:black;font-family:newtimeroman;font-size:100%;text-align:center;border-radius: 15px 50px;overflow:hidden;font-weight:500\">📌 Objectives of Notebook</div> \n\n<div style=\"border-radius:10px;\n            border :#0A0104 solid;\n            padding: 15px;\n            background-color:  ;\n           font-size:110%;\n            text-align: left\">\n    <center>\n        > 📥 Load the dataset 💻\n        <br>\n        > 📚 Import the necessary libraries 🔧\n        <br>\n        > 🕵🏻‍♀️ Show example images from the dataset 🖼️\n        <br>\n        > 📖 Explain basic concepts related to the project 💡\n        <br>\n        > 🐝Analyze the relationship between attributes.\n        <br>\n        > 🗺️Practice using libraries to visualize data.\n    </center>\n</div>\n","metadata":{"papermill":{"duration":0.005722,"end_time":"2023-02-04T14:41:18.946910","exception":false,"start_time":"2023-02-04T14:41:18.941188","status":"completed"},"tags":[]}},{"cell_type":"markdown","source":"<a id=\"2\"></a>\n# <div style=\"padding:10px;background-color:#8000ff;margin:0;color:black;font-family:newtimeroman;font-size:100%;text-align:center;border-radius: 15px 50px;overflow:hidden;font-weight:500\">🎯 Goals</div> \n\nThe goal of this competition is to predict student performance during game-based learning in real-time using one of the largest open datasets of game logs. The purpose of this competition is to advance research into knowledge-tracing methods for game-based learning and to help game developers create more effective learning experiences for students. The competition is hosted by Field Day Lab, a publicly-funded research lab at the Wisconsin Center for Educational Research, with the support of the Walton Family Foundation and Schmidt Futures.\n","metadata":{"papermill":{"duration":0.005438,"end_time":"2023-02-04T14:41:18.958322","exception":false,"start_time":"2023-02-04T14:41:18.952884","status":"completed"},"tags":[]}},{"cell_type":"markdown","source":"<a id=\"3\"></a>\n# <p style=\"padding:10px;background-color:#8000ff;margin:0;color:black;font-family:newtimeroman;font-size:100%;text-align:center;border-radius: 15px 50px;overflow:hidden;font-weight:500\">📖 Basic concepts</p>\n_ _ _\n<center>\n    <font size=\"6\">\n        Introduction\n    </font>\n</center>\n\n- - - \n\nThe field of education is constantly evolving and finding new ways to make learning more engaging and enjoyable for students. Game-based learning has emerged as a popular approach that combines education and entertainment, allowing students to learn while playing games. However, there is still a lack of research into how to effectively use data science and learning analytics to improve game-based learning.\n\nThe goal of this competition is to help fill this gap by providing a platform for data scientists and researchers to develop models that can predict student performance during game-based learning in real-time. The competition is hosted by Field Day Lab, a publicly-funded research lab at the Wisconsin Center for Educational Research, and is supported by the Walton Family Foundation and Schmidt Futures.\n\nThis competition offers a unique opportunity for participants to make a meaningful impact in the field of education by advancing research into knowledge-tracing methods for game-based learning. By developing a model that accurately predicts student performance, participants will support game developers in creating more effective learning experiences and contributing to the broader support of game-based learning platforms.\n\n_ _ _\n<center>\n    <font size=\"6\">\n        Predict Student Performance from Game Play\n    </font>\n</center>\n\n- - - \n\nPredicting student performance from game play refers to the process of using data collected from students' interactions with educational games to make predictions about their learning and performance. This involves analyzing the game logs, which record information such as the actions taken by the students, the score they achieved, and the time taken to complete the game, to build a model that can accurately predict how well a student is likely to perform in future game-based learning sessions. The goal of this process is to provide game developers and educators with valuable insights that can be used to improve the effectiveness of game-based learning and to better support individual students.\n\n_ _ _\n<center>\n    <font size=\"6\">\n       Brief Definition\n    </font>\n</center>\n\n_ _ _\n\n> __Game-based learning__ => An educational approach where students learn through playing games.\n\n> __Knowledge tracing__ => A method used in online learning environments and intelligent tutoring systems to track a student's understanding of a particular topic.\n\n> __Educational games__ => Games that have an educational purpose or focus.\n\n> __Data science__ => The field that deals with the extraction of insights and knowledge from data using statistical and computational methods.\n\n> __Learning analytics__ => The measurement, collection, analysis, and reporting of data about learners and their contexts, for purposes of understanding and optimizing learning and the environments in which it occurs.\n\n> __Real-time prediction__ => A prediction made in real-time, as events unfold.\n\n> __Open dataset__ => A dataset that is freely available for anyone to use.\n\n> __Publicly-funded research lab__ => A research lab that is funded by public funds, as opposed to private funds or industry funding.","metadata":{"papermill":{"duration":0.005421,"end_time":"2023-02-04T14:41:18.969377","exception":false,"start_time":"2023-02-04T14:41:18.963956","status":"completed"},"tags":[]}},{"cell_type":"markdown","source":"<a id=\"4\"></a>\n# <p style=\"padding:10px;background-color:#8000ff;margin:0;color:black;font-family:newtimeroman;font-size:100%;text-align:center;border-radius: 15px 50px;overflow:hidden;font-weight:500\">📚 Importing Libraries</p>\n","metadata":{"papermill":{"duration":0.00529,"end_time":"2023-02-04T14:41:18.980442","exception":false,"start_time":"2023-02-04T14:41:18.975152","status":"completed"},"tags":[]}},{"cell_type":"code","source":"! pip install plotly==5.11.0","metadata":{"execution":{"iopub.status.busy":"2023-02-08T08:59:12.490891Z","iopub.execute_input":"2023-02-08T08:59:12.491275Z","iopub.status.idle":"2023-02-08T08:59:25.116044Z","shell.execute_reply.started":"2023-02-08T08:59:12.491244Z","shell.execute_reply":"2023-02-08T08:59:25.114854Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\nimport seaborn as sns\nimport plotly.express as px\nimport matplotlib.pyplot as plt\nimport plotly.graph_objects as go\nfrom mpl_toolkits.mplot3d import Axes3D\nfrom plotly.offline import init_notebook_mode, iplot","metadata":{"papermill":{"duration":1.701095,"end_time":"2023-02-04T14:42:18.117373","exception":false,"start_time":"2023-02-04T14:42:16.416278","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-02-08T08:59:25.117910Z","iopub.execute_input":"2023-02-08T08:59:25.118858Z","iopub.status.idle":"2023-02-08T08:59:27.307337Z","shell.execute_reply.started":"2023-02-08T08:59:25.118805Z","shell.execute_reply":"2023-02-08T08:59:27.306437Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"5\"></a>\n# <p style=\"padding:10px;background-color:#8000ff;margin:0;color:black;font-family:newtimeroman;font-size:100%;text-align:center;border-radius: 15px 50px;overflow:hidden;font-weight:500\">⚙️ CONFIG</p>","metadata":{"papermill":{"duration":0.00749,"end_time":"2023-02-04T14:42:18.134189","exception":false,"start_time":"2023-02-04T14:42:18.126699","status":"completed"},"tags":[]}},{"cell_type":"code","source":"class CFG:\n    \n    class path:\n        to_train =  '/kaggle/input/predict-student-performance-from-game-play/train.csv'\n        to_labels = '/kaggle/input/predict-student-performance-from-game-play/train_labels.csv'\n    \n    class dataloader:\n        batch_size = 10\n        random_state = 10","metadata":{"papermill":{"duration":0.021577,"end_time":"2023-02-04T14:42:18.162536","exception":false,"start_time":"2023-02-04T14:42:18.140959","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-02-08T09:05:38.322223Z","iopub.execute_input":"2023-02-08T09:05:38.322632Z","iopub.status.idle":"2023-02-08T09:05:38.328660Z","shell.execute_reply.started":"2023-02-08T09:05:38.322600Z","shell.execute_reply":"2023-02-08T09:05:38.327715Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"6\"></a>\n# <p style=\"padding:10px;background-color:#8000ff;margin:0;color:black;font-family:newtimeroman;font-size:100%;text-align:center;border-radius: 15px 50px;overflow:hidden;font-weight:500\">📥 LOADING DATASET</p>\n","metadata":{"papermill":{"duration":0.008354,"end_time":"2023-02-04T14:42:18.178136","exception":false,"start_time":"2023-02-04T14:42:18.169782","status":"completed"},"tags":[]}},{"cell_type":"code","source":"train = pd.read_csv(CFG.path.to_train)\n\nprint(f\"train.shape={train.shape}\")\ntrain.head()","metadata":{"execution":{"iopub.status.busy":"2023-02-08T08:59:27.316228Z","iopub.execute_input":"2023-02-08T08:59:27.316523Z","iopub.status.idle":"2023-02-08T09:00:32.063460Z","shell.execute_reply.started":"2023-02-08T08:59:27.316495Z","shell.execute_reply":"2023-02-08T09:00:32.062204Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(f\"Avalible columns : {list(train)}\")","metadata":{"execution":{"iopub.status.busy":"2023-02-08T09:00:32.067816Z","iopub.execute_input":"2023-02-08T09:00:32.068415Z","iopub.status.idle":"2023-02-08T09:00:32.077511Z","shell.execute_reply.started":"2023-02-08T09:00:32.068377Z","shell.execute_reply":"2023-02-08T09:00:32.076669Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels = pd.read_csv(CFG.path.to_labels)\n\nprint(f\"labels.shape={labels.shape}\")\nlabels.head()","metadata":{"execution":{"iopub.status.busy":"2023-02-08T09:00:32.081656Z","iopub.execute_input":"2023-02-08T09:00:32.082573Z","iopub.status.idle":"2023-02-08T09:00:32.336817Z","shell.execute_reply.started":"2023-02-08T09:00:32.082533Z","shell.execute_reply":"2023-02-08T09:00:32.335881Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"7\"></a>\n# <p style=\"padding:10px;background-color:#8000ff;margin:0;color:black;font-family:newtimeroman;font-size:100%;text-align:center;border-radius: 15px 50px;overflow:hidden;font-weight:500\">📈 Interesting chartsms</p>\n","metadata":{}},{"cell_type":"code","source":"event_count = train['event_name'].value_counts().reset_index()\nevent_count.columns = ['event_name', 'count']\n\nfig = px.bar(event_count, x='event_name', y='count', color='count', title=\"Count the number of occurrences of each event\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-08T08:53:13.290409Z","iopub.execute_input":"2023-02-08T08:53:13.290767Z","iopub.status.idle":"2023-02-08T08:53:15.054989Z","shell.execute_reply.started":"2023-02-08T08:53:13.290737Z","shell.execute_reply":"2023-02-08T08:53:15.052198Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"name_count = train['name'].value_counts().reset_index()\nname_count.columns = ['name', 'count']\n\nfig = px.bar(name_count, x='name', y='count', color='count', title=\"Count the number of occurrences of each name\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-08T08:53:15.056213Z","iopub.execute_input":"2023-02-08T08:53:15.056878Z","iopub.status.idle":"2023-02-08T08:53:15.958679Z","shell.execute_reply.started":"2023-02-08T08:53:15.056843Z","shell.execute_reply":"2023-02-08T08:53:15.957467Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"page_count = train['page'].value_counts().reset_index()\npage_count.columns = ['page', 'count']\n\nfig = px.bar(page_count, x='page', y='count', color='count', title=\"Count the number of occurrences of each page\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-08T08:53:15.959928Z","iopub.execute_input":"2023-02-08T08:53:15.960239Z","iopub.status.idle":"2023-02-08T08:53:16.053934Z","shell.execute_reply.started":"2023-02-08T08:53:15.960210Z","shell.execute_reply":"2023-02-08T08:53:16.053112Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"events_in_session = pd.DataFrame(train.groupby('session_id').size())\nevents_in_session.columns = [\"n_of_events\"]\n\nfig = px.histogram(events_in_session, x=\"n_of_events\", title=\"Types of events in dataset\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-02-08T08:53:16.054962Z","iopub.execute_input":"2023-02-08T08:53:16.055970Z","iopub.status.idle":"2023-02-08T08:53:16.362418Z","shell.execute_reply.started":"2023-02-08T08:53:16.055936Z","shell.execute_reply":"2023-02-08T08:53:16.361609Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"8\"></a>\n# <p style=\"padding:10px;background-color:#8000ff;margin:0;color:black;font-family:newtimeroman;font-size:100%;text-align:center;border-radius: 15px 50px;overflow:hidden;font-weight:500\">💻 Example Dataloader</p>\n","metadata":{}},{"cell_type":"code","source":"batch_users = train[\n    train[\"session_id\"].isin(\n        train['session_id'].drop_duplicates()\\\n                           .sample(\n                               CFG.dataloader.batch_size,\n                               random_state=CFG.dataloader.random_state\n                           ).values\n    )\n].reset_index(drop=True)\n\nprint(f\"batch_users.shape={batch_users.shape}\")\nbatch_users.head()","metadata":{"execution":{"iopub.status.busy":"2023-02-08T09:10:24.021134Z","iopub.execute_input":"2023-02-08T09:10:24.021538Z","iopub.status.idle":"2023-02-08T09:10:24.313183Z","shell.execute_reply.started":"2023-02-08T09:10:24.021507Z","shell.execute_reply":"2023-02-08T09:10:24.312028Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"3\"></a>\n# <p style=\"padding:10px;background-color:#8000ff;margin:0;color:black;font-family:newtimeroman;font-size:100%;text-align:center;border-radius: 15px 50px;overflow:hidden;font-weight:500\">Thank you for watching!</p>\n\n<center> <img src=\"https://raw.githubusercontent.com/ntclai/PictureForMyProject/main/87481-of-thanks-letter-text-logo-calligraphy-drawing%20(1).png\" style='width: 600px; height: 300px;'>","metadata":{}}]}