{"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":"<a id=\"0\"></a>\n# <div style=\"box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px inset, rgb(51, 51, 51) 0px 0px 0px 3px inset; padding:20px; font-size:32px; font-family: consolas; text-align:center; display:fill; border-radius:15px;  color:rgb(34, 34, 34);\"> <b> 0. Import all dependencies </b></div>","metadata":{}},{"cell_type":"code","source":"import os\nimport random\nimport cv2\nimport pandas as pd\nimport numpy as np\nimport plotly.express as px\nimport matplotlib.pyplot as plt","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.279292Z","iopub.execute_input":"2023-08-29T09:52:37.279789Z","iopub.status.idle":"2023-08-29T09:52:37.287867Z","shell.execute_reply.started":"2023-08-29T09:52:37.279752Z","shell.execute_reply":"2023-08-29T09:52:37.285349Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class color:\n   PURPLE = '\\033[95m'\n   CYAN = '\\033[96m'\n   DARKCYAN = '\\033[36m'\n   BLUE = '\\033[94m'\n   GREEN = '\\033[92m'\n   YELLOW = '\\033[93m'\n   RED = '\\033[91m'\n   BOLD = '\\033[1m'\n   UNDERLINE = '\\033[4m'\n   END = '\\033[0m'","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.289797Z","iopub.execute_input":"2023-08-29T09:52:37.290153Z","iopub.status.idle":"2023-08-29T09:52:37.313312Z","shell.execute_reply.started":"2023-08-29T09:52:37.290122Z","shell.execute_reply":"2023-08-29T09:52:37.310620Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"1\"></a>\n# <div style=\"box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px inset, rgb(51, 51, 51) 0px 0px 0px 3px inset; padding:20px; font-size:32px; font-family: consolas; text-align:center; display:fill; border-radius:15px;  color:rgb(34, 34, 34);\"> <b> 1. Overview availiable directories </b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ The data series include three datasets, collected under distinct circumstances:</p>\n\n* <p style=\"font-family: consolas; font-size: 16px;\">The <b>tDCS FOG</b> (<code>tdcsfog</code>) dataset, comprising data series collected in the lab, as subjects completed a FOG-provoking protocol.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\">The <b>DeFOG</b> (<code>defog</code>) dataset, comprising data series collected in the subject's home, as subjects completed a FOG-provoking protocol.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\">The <b>Daily Living</b> (<code>daily</code>) dataset, comprising one week of continuous 24/7 recordings from sixty-five subjects. Forty-five subjects exhibit FOG symptoms and also have series in the <code>defog</code> dataset, while the other twenty subjects do not exhibit FOG symptoms and do not have series elsewhere in the data.</p>\n\n\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ Trials from the <code>tdcsfog</code> and <code>defog</code> datasets were videotaped and annotated by expert reviewers documented the freezing of gait episodes. That is, the start, end and type of each episode were marked by the experts. Series in the <code>daily</code> dataset are unannotated.</p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ You will be detecting FOG episodes for the <code>tdcsfog</code> and <code>defog</code> series. You may wish to apply unsupervised or semi-supervised methods to the series in the <code>daily</code> dataset to support your detection modelling.</p>\n<p style=\"font-family: consolas; font-size: 16px;\">🔴 See this page for more on these datasets as well as video examples of freezing of gait events: <a href=\"https://www.kaggle.com/competitions/tlvmc-parkinsons-freezing-gait-prediction/overview/additional-data-documentation\"><strong>Additional Data Documentation</strong></a>.</p>","metadata":{}},{"cell_type":"markdown","source":"<a id=\"1.1\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 1.1 Overview <i>train/</i> directory</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ <b>train/</b> Folder containing the data series in the training set within three subfolders: <b>tdcsfog/</b>, <b>defog/</b>, and <b>notype/</b>. Series in the notype folder are from the <code>defog</code> dataset but lack event-type annotations. The fields present in these series vary by folder.</p>\n\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Time</code> An integer timestep. Series from the <code>tdcsfog</code> dataset are recorded at 128Hz (128 timesteps per second), while series from the <code>defog</code> and <code>daily</code> series are recorded at 100Hz (100 timesteps per second).</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>AccV</code>, <code>AccML</code>, and <code>AccAP</code> Acceleration in units of g, from a lower-back sensor on three axes: V - vertical, ML - mediolateral, AP - anteroposterior.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>StartHesitation</code>, <code>Turn</code>, <code>Walking</code> Indicator variables for the occurrence of each of the event types.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Event</code> Indicator variable for the occurrence of any FOG-type event. Present only in the <b>notype</b> series, which lack type-level annotations.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Valid</code> There were cases during the video annotation that were hard for the annotator to decide if there was an Akinetic (i.e., essentially no movement) FoG or the subject stopped voluntarily. Only event annotations where the series is marked true should be considered as unambiguous.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Task</code> Series were only annotated where this value is <b>true</b>. Portions marked <b>false</b> should be considered unannotated.</p>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ let's check what directories are in the train folder.</p>","metadata":{}},{"cell_type":"code","source":"os.listdir(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/train\")","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.316509Z","iopub.execute_input":"2023-08-29T09:52:37.316969Z","iopub.status.idle":"2023-08-29T09:52:37.329126Z","shell.execute_reply.started":"2023-08-29T09:52:37.316922Z","shell.execute_reply":"2023-08-29T09:52:37.328124Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = len(os.listdir(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/train/tdcsfog\"))\nprint(\n    f\"Number of files in folder tdcsfog/: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.330615Z","iopub.execute_input":"2023-08-29T09:52:37.331187Z","iopub.status.idle":"2023-08-29T09:52:37.343644Z","shell.execute_reply.started":"2023-08-29T09:52:37.331091Z","shell.execute_reply":"2023-08-29T09:52:37.342466Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the data looks like.</p>","metadata":{}},{"cell_type":"code","source":"train_tdcsfog_example_df = pd.read_csv(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/train/tdcsfog/003f117e14.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.347827Z","iopub.execute_input":"2023-08-29T09:52:37.350102Z","iopub.status.idle":"2023-08-29T09:52:37.365510Z","shell.execute_reply.started":"2023-08-29T09:52:37.350025Z","shell.execute_reply":"2023-08-29T09:52:37.363730Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = len(train_tdcsfog_example_df)\nprint(\n    f\"Length of dataframe: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.367447Z","iopub.execute_input":"2023-08-29T09:52:37.369694Z","iopub.status.idle":"2023-08-29T09:52:37.376936Z","shell.execute_reply.started":"2023-08-29T09:52:37.369633Z","shell.execute_reply":"2023-08-29T09:52:37.376086Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_tdcsfog_example_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.378202Z","iopub.execute_input":"2023-08-29T09:52:37.378904Z","iopub.status.idle":"2023-08-29T09:52:37.410261Z","shell.execute_reply.started":"2023-08-29T09:52:37.378862Z","shell.execute_reply":"2023-08-29T09:52:37.408992Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_tdcsfog_example_df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.413168Z","iopub.execute_input":"2023-08-29T09:52:37.413660Z","iopub.status.idle":"2023-08-29T09:52:37.456253Z","shell.execute_reply.started":"2023-08-29T09:52:37.413622Z","shell.execute_reply":"2023-08-29T09:52:37.455382Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ Is there any NaN values in the dataframe.</p>","metadata":{}},{"cell_type":"code","source":"train_tdcsfog_example_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.457530Z","iopub.execute_input":"2023-08-29T09:52:37.457999Z","iopub.status.idle":"2023-08-29T09:52:37.467517Z","shell.execute_reply.started":"2023-08-29T09:52:37.457966Z","shell.execute_reply":"2023-08-29T09:52:37.466245Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How many files are in folder <i>defog/</i>.</p>","metadata":{}},{"cell_type":"code","source":"temp = len(os.listdir(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/train/defog\"))\nprint(\n    f\"Number of files in folder defog/: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.468954Z","iopub.execute_input":"2023-08-29T09:52:37.469456Z","iopub.status.idle":"2023-08-29T09:52:37.483203Z","shell.execute_reply.started":"2023-08-29T09:52:37.469386Z","shell.execute_reply":"2023-08-29T09:52:37.481758Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How many files are in folder <i>notype/</i>.</p>","metadata":{}},{"cell_type":"code","source":"temp = len(os.listdir(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/train/notype\"))\nprint(\n    f\"Number of files in folder notype/: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.489733Z","iopub.execute_input":"2023-08-29T09:52:37.490701Z","iopub.status.idle":"2023-08-29T09:52:37.504877Z","shell.execute_reply.started":"2023-08-29T09:52:37.490658Z","shell.execute_reply":"2023-08-29T09:52:37.503484Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"1.2\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 1.2 Overview <i>test/</i> directory</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ <b>test/</b> Only the <code>Time</code>, <code>AccV</code>, <code>AccML</code>, and <code>AccAP</code> fields are provided for the test series.</p>\n","metadata":{}},{"cell_type":"code","source":"os.listdir(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/test\")","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.507282Z","iopub.execute_input":"2023-08-29T09:52:37.508003Z","iopub.status.idle":"2023-08-29T09:52:37.519738Z","shell.execute_reply.started":"2023-08-29T09:52:37.507960Z","shell.execute_reply":"2023-08-29T09:52:37.518622Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How many files are in folder <i>tdcsfog/</i>.</p>","metadata":{}},{"cell_type":"code","source":"temp = len(os.listdir(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/test/tdcsfog\"))\nprint(\n    f\"Number of files in folder tdcsfog/: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.521442Z","iopub.execute_input":"2023-08-29T09:52:37.522668Z","iopub.status.idle":"2023-08-29T09:52:37.544844Z","shell.execute_reply.started":"2023-08-29T09:52:37.522623Z","shell.execute_reply":"2023-08-29T09:52:37.543316Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How many files are in folder <i>defog/</i>.</p>","metadata":{}},{"cell_type":"code","source":"temp = len(os.listdir(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/test/defog\"))\nprint(\n    f\"Number of files in folder defog/: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.546569Z","iopub.execute_input":"2023-08-29T09:52:37.548298Z","iopub.status.idle":"2023-08-29T09:52:37.559823Z","shell.execute_reply.started":"2023-08-29T09:52:37.548250Z","shell.execute_reply":"2023-08-29T09:52:37.558218Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the test data looks like.</p>","metadata":{}},{"cell_type":"code","source":"test_tdcsfog_example_df = pd.read_csv(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/test/tdcsfog/003f117e14.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.562521Z","iopub.execute_input":"2023-08-29T09:52:37.562900Z","iopub.status.idle":"2023-08-29T09:52:37.582089Z","shell.execute_reply.started":"2023-08-29T09:52:37.562863Z","shell.execute_reply":"2023-08-29T09:52:37.580950Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = len(test_tdcsfog_example_df)\nprint(\n    f\"Length of dataframe: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.586946Z","iopub.execute_input":"2023-08-29T09:52:37.588763Z","iopub.status.idle":"2023-08-29T09:52:37.595800Z","shell.execute_reply.started":"2023-08-29T09:52:37.588702Z","shell.execute_reply":"2023-08-29T09:52:37.594614Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_tdcsfog_example_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.598831Z","iopub.execute_input":"2023-08-29T09:52:37.599790Z","iopub.status.idle":"2023-08-29T09:52:37.631232Z","shell.execute_reply.started":"2023-08-29T09:52:37.599744Z","shell.execute_reply":"2023-08-29T09:52:37.629579Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_tdcsfog_example_df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.632851Z","iopub.execute_input":"2023-08-29T09:52:37.633199Z","iopub.status.idle":"2023-08-29T09:52:37.667186Z","shell.execute_reply.started":"2023-08-29T09:52:37.633170Z","shell.execute_reply":"2023-08-29T09:52:37.666242Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"1.3\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 1.3 Overview <i>unlabeled/</i> directory</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ <b>unlabeled/</b> Folder containing the unannotated data series from the <code>daily</code> dataset, one series per subject. Forty-five of the subjects also have series in the <code>defog</code> dataset, some in the training split and some in the test split.</p>\n","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How many files are in folder <i>unlabeled/</i>.</p>","metadata":{}},{"cell_type":"code","source":"temp = len(os.listdir(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/unlabeled\"))\nprint(\n    f\"Number of files in folder unlabeled/: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.668597Z","iopub.execute_input":"2023-08-29T09:52:37.668895Z","iopub.status.idle":"2023-08-29T09:52:37.675096Z","shell.execute_reply.started":"2023-08-29T09:52:37.668867Z","shell.execute_reply":"2023-08-29T09:52:37.673982Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the data looks like.</p>","metadata":{}},{"cell_type":"code","source":"unlabeled_example_df = pd.read_parquet(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/unlabeled/00c4c9313d.parquet\")","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:37.676241Z","iopub.execute_input":"2023-08-29T09:52:37.677218Z","iopub.status.idle":"2023-08-29T09:52:40.108552Z","shell.execute_reply.started":"2023-08-29T09:52:37.677187Z","shell.execute_reply":"2023-08-29T09:52:40.107692Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"unlabeled_example_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:40.110017Z","iopub.execute_input":"2023-08-29T09:52:40.110326Z","iopub.status.idle":"2023-08-29T09:52:40.123301Z","shell.execute_reply.started":"2023-08-29T09:52:40.110297Z","shell.execute_reply":"2023-08-29T09:52:40.121809Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"unlabeled_example_df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:40.125011Z","iopub.execute_input":"2023-08-29T09:52:40.126004Z","iopub.status.idle":"2023-08-29T09:52:46.422170Z","shell.execute_reply.started":"2023-08-29T09:52:40.125939Z","shell.execute_reply":"2023-08-29T09:52:46.420567Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"2\"></a>\n# <div style=\"box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px inset, rgb(51, 51, 51) 0px 0px 0px 3px inset; padding:20px; font-size:32px; font-family: consolas; text-align:center; display:fill; border-radius:15px;  color:rgb(34, 34, 34);\"> <b> 2. Overview availiable csv files </b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ <b>tdcsfog_metadata.csv</b> Identifies each series in the <code>tdcsfog</code> dataset by a unique <code>Subject, Visit, Test, Medication</code> condition.</p>\n\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Visit</code> Lab visits consist of a baseline assessment, two post-treatment assessments for different treatment stages, and one follow-up assessment.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Test</code> Which of three test types was performed, with 3 the most challenging.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Medication</code> Subjects may have been either off or on anti-parkinsonian medication during the recording.</p>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the data looks like.</p>","metadata":{}},{"cell_type":"code","source":"tdcsfog_metadata_df = pd.read_csv(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/tdcsfog_metadata.csv\") ","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.424170Z","iopub.execute_input":"2023-08-29T09:52:46.424873Z","iopub.status.idle":"2023-08-29T09:52:46.438789Z","shell.execute_reply.started":"2023-08-29T09:52:46.424826Z","shell.execute_reply":"2023-08-29T09:52:46.436687Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tdcsfog_metadata_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.445290Z","iopub.execute_input":"2023-08-29T09:52:46.445692Z","iopub.status.idle":"2023-08-29T09:52:46.459122Z","shell.execute_reply.started":"2023-08-29T09:52:46.445655Z","shell.execute_reply":"2023-08-29T09:52:46.457556Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tdcsfog_metadata_df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.460541Z","iopub.execute_input":"2023-08-29T09:52:46.460874Z","iopub.status.idle":"2023-08-29T09:52:46.487342Z","shell.execute_reply.started":"2023-08-29T09:52:46.460840Z","shell.execute_reply":"2023-08-29T09:52:46.486171Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ What is length of the dataframe.</p>","metadata":{}},{"cell_type":"code","source":"temp = len(tdcsfog_metadata_df)\nprint(\n    f\"Length of the tdcsfog_metadata.csv file is: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.489130Z","iopub.execute_input":"2023-08-29T09:52:46.489596Z","iopub.status.idle":"2023-08-29T09:52:46.500120Z","shell.execute_reply.started":"2023-08-29T09:52:46.489554Z","shell.execute_reply":"2023-08-29T09:52:46.498260Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How many unique subjects the dataframe has.</p>","metadata":{}},{"cell_type":"code","source":"temp = len(tdcsfog_metadata_df.Subject.unique())\nprint(\n    f\"Number of unique subjects: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.501205Z","iopub.execute_input":"2023-08-29T09:52:46.501607Z","iopub.status.idle":"2023-08-29T09:52:46.517077Z","shell.execute_reply.started":"2023-08-29T09:52:46.501570Z","shell.execute_reply":"2023-08-29T09:52:46.515563Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the data for an unique subject looks like.</p>","metadata":{}},{"cell_type":"code","source":"unique_subject_id = \"13abfd\"\ntdcsfog_metadata_df[tdcsfog_metadata_df.Subject == unique_subject_id]","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.519427Z","iopub.execute_input":"2023-08-29T09:52:46.519884Z","iopub.status.idle":"2023-08-29T09:52:46.542112Z","shell.execute_reply.started":"2023-08-29T09:52:46.519832Z","shell.execute_reply":"2023-08-29T09:52:46.540006Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ Is there any missing data in the dataframe.</p>","metadata":{}},{"cell_type":"code","source":"tdcsfog_metadata_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.543978Z","iopub.execute_input":"2023-08-29T09:52:46.544435Z","iopub.status.idle":"2023-08-29T09:52:46.560607Z","shell.execute_reply.started":"2023-08-29T09:52:46.544371Z","shell.execute_reply":"2023-08-29T09:52:46.559026Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the bar chart looks like for categorical field <code>Visit</code>.</p>","metadata":{}},{"cell_type":"code","source":"tdcsfog_visit_counts = tdcsfog_metadata_df.Visit.value_counts()\n\nfig = px.bar(x=tdcsfog_visit_counts.index, y=tdcsfog_visit_counts.values)\nfig.update_layout(xaxis_title=\"Visit\", yaxis_title=\"Count\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.561843Z","iopub.execute_input":"2023-08-29T09:52:46.562224Z","iopub.status.idle":"2023-08-29T09:52:46.643108Z","shell.execute_reply.started":"2023-08-29T09:52:46.562185Z","shell.execute_reply":"2023-08-29T09:52:46.640788Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the bar chart looks like for categorical field <code>Test</code>.</p>","metadata":{}},{"cell_type":"code","source":"tdcsfog_test_counts = tdcsfog_metadata_df.Test.value_counts()\n\nfig = px.bar(x=tdcsfog_test_counts.index, y=tdcsfog_test_counts.values)\nfig.update_layout(xaxis_title=\"Test\", yaxis_title=\"Count\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.645196Z","iopub.execute_input":"2023-08-29T09:52:46.645655Z","iopub.status.idle":"2023-08-29T09:52:46.713080Z","shell.execute_reply.started":"2023-08-29T09:52:46.645623Z","shell.execute_reply":"2023-08-29T09:52:46.710179Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the bar chart looks like for categorical field <code>Medication</code>.</p>","metadata":{}},{"cell_type":"code","source":"tdcsfog_medication_counts = tdcsfog_metadata_df.Medication.value_counts()\n\nfig = px.bar(x=tdcsfog_medication_counts.index, y=tdcsfog_medication_counts.values)\nfig.update_layout(xaxis_title=\"Medication\", yaxis_title=\"Count\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.714635Z","iopub.execute_input":"2023-08-29T09:52:46.714946Z","iopub.status.idle":"2023-08-29T09:52:46.785654Z","shell.execute_reply.started":"2023-08-29T09:52:46.714919Z","shell.execute_reply":"2023-08-29T09:52:46.783412Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"2.2\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 2.2 Overview <i>defog_metadata.csv</i> file</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ <b>defog_metadata.csv</b> Identifies each series in the <code>defog</code> dataset by a unique <code>Subject, Visit, Medication</code> condition.</p>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the data looks like.</p>","metadata":{}},{"cell_type":"code","source":"defog_metadata_df = pd.read_csv(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/defog_metadata.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.787642Z","iopub.execute_input":"2023-08-29T09:52:46.788150Z","iopub.status.idle":"2023-08-29T09:52:46.800181Z","shell.execute_reply.started":"2023-08-29T09:52:46.788098Z","shell.execute_reply":"2023-08-29T09:52:46.797312Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"defog_metadata_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.802764Z","iopub.execute_input":"2023-08-29T09:52:46.803172Z","iopub.status.idle":"2023-08-29T09:52:46.822472Z","shell.execute_reply.started":"2023-08-29T09:52:46.803132Z","shell.execute_reply":"2023-08-29T09:52:46.820678Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ Is there any missing data.</p>","metadata":{}},{"cell_type":"code","source":"defog_metadata_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.823925Z","iopub.execute_input":"2023-08-29T09:52:46.824253Z","iopub.status.idle":"2023-08-29T09:52:46.839755Z","shell.execute_reply.started":"2023-08-29T09:52:46.824218Z","shell.execute_reply":"2023-08-29T09:52:46.837938Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ What is length of the dataframe.</p>","metadata":{}},{"cell_type":"code","source":"temp = len(defog_metadata_df)\nprint(\n    f\"Length of the defog_metadata.csv file is: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.842183Z","iopub.execute_input":"2023-08-29T09:52:46.842598Z","iopub.status.idle":"2023-08-29T09:52:46.851257Z","shell.execute_reply.started":"2023-08-29T09:52:46.842553Z","shell.execute_reply":"2023-08-29T09:52:46.849969Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = len(defog_metadata_df.Subject.unique())\nprint(\n    f\"Number of unique subjects: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.853259Z","iopub.execute_input":"2023-08-29T09:52:46.853741Z","iopub.status.idle":"2023-08-29T09:52:46.868965Z","shell.execute_reply.started":"2023-08-29T09:52:46.853689Z","shell.execute_reply":"2023-08-29T09:52:46.868010Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the data for an unique subject looks like.</p>","metadata":{}},{"cell_type":"code","source":"unique_subject_id = \"bf608b\"\ndefog_metadata_df[defog_metadata_df.Subject == unique_subject_id]","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.870158Z","iopub.execute_input":"2023-08-29T09:52:46.871482Z","iopub.status.idle":"2023-08-29T09:52:46.890708Z","shell.execute_reply.started":"2023-08-29T09:52:46.871366Z","shell.execute_reply":"2023-08-29T09:52:46.888967Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the bar chart looks like for categorical field <code>Visit</code>.</p>","metadata":{}},{"cell_type":"code","source":"defog_visit_counts = defog_metadata_df.Visit.value_counts()\n\nfig = px.bar(x=defog_visit_counts.index, y=defog_visit_counts.values)\nfig.update_layout(xaxis_title=\"Visit\", yaxis_title=\"Count\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.892560Z","iopub.execute_input":"2023-08-29T09:52:46.893218Z","iopub.status.idle":"2023-08-29T09:52:46.968334Z","shell.execute_reply.started":"2023-08-29T09:52:46.893177Z","shell.execute_reply":"2023-08-29T09:52:46.966901Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the bar chart looks like for categorical field <code>Medication</code>.</p>","metadata":{}},{"cell_type":"code","source":"defog_medication_counts = defog_metadata_df.Medication.value_counts()\n\nfig = px.bar(x=defog_medication_counts.index, y=defog_medication_counts.values)\nfig.update_layout(xaxis_title=\"Medication\", yaxis_title=\"Count\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:46.970679Z","iopub.execute_input":"2023-08-29T09:52:46.971351Z","iopub.status.idle":"2023-08-29T09:52:47.038011Z","shell.execute_reply.started":"2023-08-29T09:52:46.971308Z","shell.execute_reply":"2023-08-29T09:52:47.035132Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"2.3\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 2.3 Overview <i>daily_metadata.csv</i> file</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ <b>daily_metadata.csv</b> Each series in the <code>daily</code> dataset is identified by the <code>Subject</code> id. This file also contains the time of day the recording began.</p>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the data looks like.</p>","metadata":{}},{"cell_type":"code","source":"daily_metadata_df = pd.read_csv(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/daily_metadata.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.039617Z","iopub.execute_input":"2023-08-29T09:52:47.039961Z","iopub.status.idle":"2023-08-29T09:52:47.053591Z","shell.execute_reply.started":"2023-08-29T09:52:47.039930Z","shell.execute_reply":"2023-08-29T09:52:47.051632Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"daily_metadata_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.056681Z","iopub.execute_input":"2023-08-29T09:52:47.058877Z","iopub.status.idle":"2023-08-29T09:52:47.074251Z","shell.execute_reply.started":"2023-08-29T09:52:47.058787Z","shell.execute_reply":"2023-08-29T09:52:47.072169Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ Is there any missing data.</p>","metadata":{}},{"cell_type":"code","source":"daily_metadata_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.078306Z","iopub.execute_input":"2023-08-29T09:52:47.078771Z","iopub.status.idle":"2023-08-29T09:52:47.088237Z","shell.execute_reply.started":"2023-08-29T09:52:47.078731Z","shell.execute_reply":"2023-08-29T09:52:47.087447Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ What is length of the dataframe.</p>","metadata":{}},{"cell_type":"code","source":"temp = len(daily_metadata_df)\nprint(\n    f\"Length of the daily_metadata.csv file is: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.090360Z","iopub.execute_input":"2023-08-29T09:52:47.090786Z","iopub.status.idle":"2023-08-29T09:52:47.106692Z","shell.execute_reply.started":"2023-08-29T09:52:47.090756Z","shell.execute_reply":"2023-08-29T09:52:47.105023Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = len(daily_metadata_df.Subject.unique())\nprint(\n    f\"Number of unique subjects: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.108207Z","iopub.execute_input":"2023-08-29T09:52:47.108883Z","iopub.status.idle":"2023-08-29T09:52:47.129208Z","shell.execute_reply.started":"2023-08-29T09:52:47.108843Z","shell.execute_reply":"2023-08-29T09:52:47.127293Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the bar chart looks like for categorical field <code>Visit</code>.</p>","metadata":{}},{"cell_type":"code","source":"daily_visit_counts = daily_metadata_df.Visit.value_counts()\n\nfig = px.bar(x=daily_visit_counts.index, y=daily_visit_counts.values)\nfig.update_layout(xaxis_title=\"Visit\", yaxis_title=\"Count\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.131084Z","iopub.execute_input":"2023-08-29T09:52:47.131991Z","iopub.status.idle":"2023-08-29T09:52:47.201997Z","shell.execute_reply.started":"2023-08-29T09:52:47.131948Z","shell.execute_reply":"2023-08-29T09:52:47.199959Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the bar chart looks like for the field <code>Beginning of recording</code>.</p>","metadata":{}},{"cell_type":"code","source":"daily_bor_counts = daily_metadata_df[\"Beginning of recording [00:00-23:59]\"].value_counts()\n\nfig = px.bar(x=daily_bor_counts.index, y=daily_bor_counts.values)\nfig.update_layout(xaxis_title=\"Beginning of recording\", yaxis_title=\"Count\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.203667Z","iopub.execute_input":"2023-08-29T09:52:47.203989Z","iopub.status.idle":"2023-08-29T09:52:47.269104Z","shell.execute_reply.started":"2023-08-29T09:52:47.203957Z","shell.execute_reply":"2023-08-29T09:52:47.267386Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"2.4\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 2.4 Overview <i>subjects.csv</i> file</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ <b>subjects.csv</b> Metadata for each <code>Subject</code> in the study, including their <code>Age</code> and <code>Sex</code> as well as:</p>\n\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Visit</code> Only available for subjects in the daily and defog datasets.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>YearsSinceDx</code> Years since Parkinson's diagnosis.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>UPDRSIIIOn</code>/<code>UPDRSIIIOff</code> Unified Parkinson's Disease Rating Scale score during on/off medication respectively.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>NFOGQ</code> Self-report <a href=\"https://pubmed.ncbi.nlm.nih.gov/19660949/\"><strong>FoG questionnaire score</strong></a>.</p>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the data looks like.</p>","metadata":{}},{"cell_type":"code","source":"subjects_df = pd.read_csv(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/subjects.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.270701Z","iopub.execute_input":"2023-08-29T09:52:47.271012Z","iopub.status.idle":"2023-08-29T09:52:47.283675Z","shell.execute_reply.started":"2023-08-29T09:52:47.270984Z","shell.execute_reply":"2023-08-29T09:52:47.282189Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"subjects_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.285622Z","iopub.execute_input":"2023-08-29T09:52:47.286120Z","iopub.status.idle":"2023-08-29T09:52:47.309854Z","shell.execute_reply.started":"2023-08-29T09:52:47.286073Z","shell.execute_reply":"2023-08-29T09:52:47.305733Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ Is there any missing data.</p>","metadata":{}},{"cell_type":"code","source":"subjects_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.312165Z","iopub.execute_input":"2023-08-29T09:52:47.312687Z","iopub.status.idle":"2023-08-29T09:52:47.329072Z","shell.execute_reply.started":"2023-08-29T09:52:47.312647Z","shell.execute_reply":"2023-08-29T09:52:47.326965Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ What is length of the dataframe.</p>","metadata":{}},{"cell_type":"code","source":"temp = len(subjects_df)\nprint(\n    f\"Length of the subjects.csv file is: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.340628Z","iopub.execute_input":"2023-08-29T09:52:47.341007Z","iopub.status.idle":"2023-08-29T09:52:47.347177Z","shell.execute_reply.started":"2023-08-29T09:52:47.340978Z","shell.execute_reply":"2023-08-29T09:52:47.345971Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = len(subjects_df.Subject.unique())\nprint(\n    f\"Number of unique subjects: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.348352Z","iopub.execute_input":"2023-08-29T09:52:47.348673Z","iopub.status.idle":"2023-08-29T09:52:47.362993Z","shell.execute_reply.started":"2023-08-29T09:52:47.348644Z","shell.execute_reply":"2023-08-29T09:52:47.360984Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the bar chart looks like for categorical field <code>Visit</code>.</p>","metadata":{}},{"cell_type":"code","source":"subjects_visit_counts = subjects_df.Visit.value_counts()\n\nfig = px.bar(x=subjects_visit_counts.index, y=subjects_visit_counts.values)\nfig.update_layout(xaxis_title=\"Visit\", yaxis_title=\"Count\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.366110Z","iopub.execute_input":"2023-08-29T09:52:47.366618Z","iopub.status.idle":"2023-08-29T09:52:47.430924Z","shell.execute_reply.started":"2023-08-29T09:52:47.366568Z","shell.execute_reply":"2023-08-29T09:52:47.429485Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ What is the distibution of the field <code>Age</code>.</p>","metadata":{}},{"cell_type":"code","source":"fig = px.histogram(subjects_df, x=\"Age\", nbins=30)\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.432582Z","iopub.execute_input":"2023-08-29T09:52:47.433149Z","iopub.status.idle":"2023-08-29T09:52:47.491714Z","shell.execute_reply.started":"2023-08-29T09:52:47.433110Z","shell.execute_reply":"2023-08-29T09:52:47.490718Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the bar chart looks like for categorical field <code>Sex</code>.</p>","metadata":{}},{"cell_type":"code","source":"subjects_sex_counts = subjects_df.Sex.value_counts()\n\nfig = px.bar(x=subjects_sex_counts.index, y=subjects_sex_counts.values)\nfig.update_layout(xaxis_title=\"Sex\", yaxis_title=\"Count\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.493462Z","iopub.execute_input":"2023-08-29T09:52:47.494586Z","iopub.status.idle":"2023-08-29T09:52:47.553619Z","shell.execute_reply.started":"2023-08-29T09:52:47.494543Z","shell.execute_reply":"2023-08-29T09:52:47.552108Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ What is the distibution of the field <code>YearsSinceDx</code>.</p>","metadata":{}},{"cell_type":"code","source":"fig = px.histogram(subjects_df, x=\"YearsSinceDx\", nbins=30)\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.555163Z","iopub.execute_input":"2023-08-29T09:52:47.555820Z","iopub.status.idle":"2023-08-29T09:52:47.613048Z","shell.execute_reply.started":"2023-08-29T09:52:47.555774Z","shell.execute_reply":"2023-08-29T09:52:47.610819Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ What is the distibution of the field <code>UPDRSIII_On</code>.</p>","metadata":{}},{"cell_type":"code","source":"fig = px.histogram(subjects_df, x=\"UPDRSIII_On\", nbins=30)\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.614787Z","iopub.execute_input":"2023-08-29T09:52:47.615262Z","iopub.status.idle":"2023-08-29T09:52:47.678166Z","shell.execute_reply.started":"2023-08-29T09:52:47.615213Z","shell.execute_reply":"2023-08-29T09:52:47.676020Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ What is the distibution of the field <code>NFOGQ</code>.</p>","metadata":{}},{"cell_type":"code","source":"fig = px.histogram(subjects_df, x=\"NFOGQ\", nbins=20)\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.679701Z","iopub.execute_input":"2023-08-29T09:52:47.680033Z","iopub.status.idle":"2023-08-29T09:52:47.748324Z","shell.execute_reply.started":"2023-08-29T09:52:47.680003Z","shell.execute_reply":"2023-08-29T09:52:47.746025Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"2.5\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 2.5 Overview <i>events.csv</i> file</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ <b>events.csv</b> Metadata for each FoG event in all data series. The event times agree with the labels in the data series.</p>\n\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Visit</code> The data series the event occured in.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Init</code> Time (s) the event began.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Completion</code> Time (s) the event ended.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Type</code> Whether <code>StartHesitation</code>, <code>Turn</code>, or <code>Walking</code>.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Kinetic</code> Whether the event was kinetic (1) and involved movement, or akinetic (0) and static.</p>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the data looks like.</p>","metadata":{}},{"cell_type":"code","source":"events_df = pd.read_csv(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/events.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.750503Z","iopub.execute_input":"2023-08-29T09:52:47.750918Z","iopub.status.idle":"2023-08-29T09:52:47.763752Z","shell.execute_reply.started":"2023-08-29T09:52:47.750880Z","shell.execute_reply":"2023-08-29T09:52:47.761339Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"events_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.766045Z","iopub.execute_input":"2023-08-29T09:52:47.766770Z","iopub.status.idle":"2023-08-29T09:52:47.785280Z","shell.execute_reply.started":"2023-08-29T09:52:47.766670Z","shell.execute_reply":"2023-08-29T09:52:47.784089Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ What is length of the dataframe.</p>","metadata":{}},{"cell_type":"code","source":"temp = len(events_df)\nprint(\n    f\"Length of the events.csv file is: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.787269Z","iopub.execute_input":"2023-08-29T09:52:47.787706Z","iopub.status.idle":"2023-08-29T09:52:47.802336Z","shell.execute_reply.started":"2023-08-29T09:52:47.787666Z","shell.execute_reply":"2023-08-29T09:52:47.801263Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ Is there any missing data.</p>","metadata":{}},{"cell_type":"code","source":"events_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.803285Z","iopub.execute_input":"2023-08-29T09:52:47.803629Z","iopub.status.idle":"2023-08-29T09:52:47.827041Z","shell.execute_reply.started":"2023-08-29T09:52:47.803594Z","shell.execute_reply":"2023-08-29T09:52:47.825146Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ What is the distibution of the field <code>Completion</code>.</p>","metadata":{}},{"cell_type":"code","source":"fig = px.histogram(events_df, x=\"Completion\", nbins=50)\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.828566Z","iopub.execute_input":"2023-08-29T09:52:47.828903Z","iopub.status.idle":"2023-08-29T09:52:47.895174Z","shell.execute_reply.started":"2023-08-29T09:52:47.828868Z","shell.execute_reply":"2023-08-29T09:52:47.893618Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the bar chart looks like for categorical field <code>Type</code>.</p>","metadata":{}},{"cell_type":"code","source":"events_type_counts = events_df.Type.value_counts()\n\nfig = px.bar(x=events_type_counts.index, y=events_type_counts.values)\nfig.update_layout(xaxis_title=\"Type\", yaxis_title=\"Count\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.897005Z","iopub.execute_input":"2023-08-29T09:52:47.897583Z","iopub.status.idle":"2023-08-29T09:52:47.957747Z","shell.execute_reply.started":"2023-08-29T09:52:47.897545Z","shell.execute_reply":"2023-08-29T09:52:47.955919Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the bar chart looks like for categorical field <code>Kinetic</code>.</p>","metadata":{}},{"cell_type":"code","source":"events_kinetic_counts = events_df.Kinetic.value_counts()\n\nfig = px.bar(x=events_kinetic_counts.index, y=events_kinetic_counts.values)\nfig.update_layout(xaxis_title=\"Kinetic\", yaxis_title=\"Count\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:47.959364Z","iopub.execute_input":"2023-08-29T09:52:47.960661Z","iopub.status.idle":"2023-08-29T09:52:48.025650Z","shell.execute_reply.started":"2023-08-29T09:52:47.960607Z","shell.execute_reply":"2023-08-29T09:52:48.022866Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"2.6\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 2.6 Overview <i>tasks.csv</i> file</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ <b>tasks.csv</b> Task metadata for series in the <code>defog</code> dataset. (Not relevant for the series in the <code>fog</code> or <code>daily</code> datasets.)</p>\n\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Id</code> The data series where the task was measured.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Begin</code> Time (s) the task began.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>End</code> Time (s) the task ended.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Task</code> One of seven tasks types in the DeFOG protocol, described on <a href=\"https://www.kaggle.com/competitions/tlvmc-parkinsons-freezing-gait-prediction/overview/additional-data-documentation\"><strong>this page</strong></a>.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"><code>Description</code> Description of the task.</p>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the data looks like.</p>","metadata":{}},{"cell_type":"code","source":"tasks_df = pd.read_csv(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/tasks.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:48.027539Z","iopub.execute_input":"2023-08-29T09:52:48.028047Z","iopub.status.idle":"2023-08-29T09:52:48.039650Z","shell.execute_reply.started":"2023-08-29T09:52:48.028012Z","shell.execute_reply":"2023-08-29T09:52:48.037231Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tasks_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:48.040901Z","iopub.execute_input":"2023-08-29T09:52:48.041247Z","iopub.status.idle":"2023-08-29T09:52:48.060479Z","shell.execute_reply.started":"2023-08-29T09:52:48.041211Z","shell.execute_reply":"2023-08-29T09:52:48.059350Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ What is length of the dataframe.</p>","metadata":{}},{"cell_type":"code","source":"temp = len(tasks_df)\nprint(\n    f\"Length of the subjects.csv file is: {color.BLUE}{temp}{color.END}\",\n)","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:48.063117Z","iopub.execute_input":"2023-08-29T09:52:48.063435Z","iopub.status.idle":"2023-08-29T09:52:48.076335Z","shell.execute_reply.started":"2023-08-29T09:52:48.063382Z","shell.execute_reply":"2023-08-29T09:52:48.075161Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ Is there any missing data.</p>","metadata":{}},{"cell_type":"code","source":"tasks_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:48.078311Z","iopub.execute_input":"2023-08-29T09:52:48.078656Z","iopub.status.idle":"2023-08-29T09:52:48.101056Z","shell.execute_reply.started":"2023-08-29T09:52:48.078622Z","shell.execute_reply":"2023-08-29T09:52:48.098899Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ What is the distibution of the difference between fields <code>Begin</code> and <code>End</code>.</p>","metadata":{}},{"cell_type":"code","source":"task_time = tasks_df.End - tasks_df.Begin\nfig = px.histogram(x=task_time, nbins=30)\nfig.show()\n#fix namings","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:48.102773Z","iopub.execute_input":"2023-08-29T09:52:48.103173Z","iopub.status.idle":"2023-08-29T09:52:48.164819Z","shell.execute_reply.started":"2023-08-29T09:52:48.103132Z","shell.execute_reply":"2023-08-29T09:52:48.163786Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">❔ How the bar chart looks like for categorical field <code>Task</code>.</p>","metadata":{}},{"cell_type":"code","source":"tasks_task_counts = tasks_df.Task.value_counts()\n\nfig = px.bar(x=tasks_task_counts.index, y=tasks_task_counts.values)\nfig.update_layout(xaxis_title=\"Task\", yaxis_title=\"Count\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-29T09:52:48.166142Z","iopub.execute_input":"2023-08-29T09:52:48.166494Z","iopub.status.idle":"2023-08-29T09:52:48.458972Z","shell.execute_reply.started":"2023-08-29T09:52:48.166460Z","shell.execute_reply":"2023-08-29T09:52:48.457660Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# <div style=\"box-shadow: rgba(240, 46, 170, 0.4) -5px 5px inset, rgba(240, 46, 170, 0.3) -10px 10px inset, rgba(240, 46, 170, 0.2) -15px 15px inset, rgba(240, 46, 170, 0.1) -20px 20px inset, rgba(240, 46, 170, 0.05) -25px 25px inset; padding:20px; font-size:30px; font-family: consolas; display:fill; border-radius:15px; color: rgba(240, 46, 170, 0.7)\"> <b> ༼⁠ ⁠つ⁠ ⁠◕⁠‿⁠◕⁠ ⁠༽⁠つ Thank You!</b></div>\n\n<p style=\"font-family:verdana; color:rgb(34, 34, 34); font-family: consolas; font-size: 16px;\"> 💌 Thank you for taking the time to read through my notebook. I hope you found it interesting and informative. If you have any feedback or suggestions for improvement, please don't hesitate to let me know in the comments. <br><br> 🚀 If you liked this notebook, please consider upvoting it so that others can discover it too. Your support means a lot to me, and it helps to motivate me to create more content in the future. <br><br> ❤️ Once again, thank you for your support, and I hope to see you again soon!</p>","metadata":{}}]}