{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import os\nimport seaborn as sns \nimport random\nimport cv2\nimport pandas as pd\nimport numpy as np\nimport plotly.express as px\nimport matplotlib.pyplot as plt","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-03-10T16:51:52.640877Z","iopub.execute_input":"2023-03-10T16:51:52.641259Z","iopub.status.idle":"2023-03-10T16:51:56.234115Z","shell.execute_reply.started":"2023-03-10T16:51:52.641225Z","shell.execute_reply":"2023-03-10T16:51:56.233079Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"os.listdir(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/train\")","metadata":{"execution":{"iopub.status.busy":"2023-03-10T14:56:25.304699Z","iopub.execute_input":"2023-03-10T14:56:25.305111Z","iopub.status.idle":"2023-03-10T14:56:25.314649Z","shell.execute_reply.started":"2023-03-10T14:56:25.305077Z","shell.execute_reply":"2023-03-10T14:56:25.313251Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-03-10T14:58:57.933927Z","iopub.execute_input":"2023-03-10T14:58:57.935129Z","iopub.status.idle":"2023-03-10T14:58:57.950092Z","shell.execute_reply.started":"2023-03-10T14:58:57.935081Z","shell.execute_reply":"2023-03-10T14:58:57.948616Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_tdcsfog_example_df.head(10)","metadata":{"execution":{"iopub.status.busy":"2023-03-10T14:59:49.847146Z","iopub.execute_input":"2023-03-10T14:59:49.847566Z","iopub.status.idle":"2023-03-10T14:59:49.861753Z","shell.execute_reply.started":"2023-03-10T14:59:49.847528Z","shell.execute_reply":"2023-03-10T14:59:49.860380Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Total number of columns ","metadata":{}},{"cell_type":"code","source":"train_tdcsfog_example_df.columns","metadata":{"execution":{"iopub.status.busy":"2023-03-10T15:04:23.708738Z","iopub.execute_input":"2023-03-10T15:04:23.709163Z","iopub.status.idle":"2023-03-10T15:04:23.716980Z","shell.execute_reply.started":"2023-03-10T15:04:23.709128Z","shell.execute_reply":"2023-03-10T15:04:23.715675Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Describing our train dataset ","metadata":{}},{"cell_type":"code","source":"train_tdcsfog_example_df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-03-10T15:00:41.868862Z","iopub.execute_input":"2023-03-10T15:00:41.869271Z","iopub.status.idle":"2023-03-10T15:00:41.916070Z","shell.execute_reply.started":"2023-03-10T15:00:41.869238Z","shell.execute_reply":"2023-03-10T15:00:41.914971Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Checking for any null values ","metadata":{}},{"cell_type":"code","source":"train_tdcsfog_example_df.isnull()","metadata":{"execution":{"iopub.status.busy":"2023-03-10T15:01:44.770313Z","iopub.execute_input":"2023-03-10T15:01:44.771579Z","iopub.status.idle":"2023-03-10T15:01:44.788760Z","shell.execute_reply.started":"2023-03-10T15:01:44.771532Z","shell.execute_reply":"2023-03-10T15:01:44.787889Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_tdcsfog_example_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-03-10T15:02:23.128563Z","iopub.execute_input":"2023-03-10T15:02:23.129307Z","iopub.status.idle":"2023-03-10T15:02:23.141211Z","shell.execute_reply.started":"2023-03-10T15:02:23.129267Z","shell.execute_reply":"2023-03-10T15:02:23.140233Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_tdcsfog_example_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-03-10T15:02:23.128563Z","iopub.execute_input":"2023-03-10T15:02:23.129307Z","iopub.status.idle":"2023-03-10T15:02:23.141211Z","shell.execute_reply.started":"2023-03-10T15:02:23.129267Z","shell.execute_reply":"2023-03-10T15:02:23.140233Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_tdcsfog_example_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-03-10T15:02:23.128563Z","iopub.execute_input":"2023-03-10T15:02:23.129307Z","iopub.status.idle":"2023-03-10T15:02:23.141211Z","shell.execute_reply.started":"2023-03-10T15:02:23.129267Z","shell.execute_reply":"2023-03-10T15:02:23.140233Z"}},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Correlation analysis of the data ","metadata":{}},{"cell_type":"code","source":"corr = train_tdcsfog_example_df.corr()","metadata":{"execution":{"iopub.status.busy":"2023-03-10T15:09:31.573129Z","iopub.execute_input":"2023-03-10T15:09:31.573661Z","iopub.status.idle":"2023-03-10T15:09:31.583976Z","shell.execute_reply.started":"2023-03-10T15:09:31.573598Z","shell.execute_reply":"2023-03-10T15:09:31.582570Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.heatmap(corr, cmap='coolwarm', annot=True, fmt=\".2f\", linewidths=0.5)","metadata":{"execution":{"iopub.status.busy":"2023-03-10T15:11:41.397117Z","iopub.execute_input":"2023-03-10T15:11:41.397560Z","iopub.status.idle":"2023-03-10T15:11:41.834195Z","shell.execute_reply.started":"2023-03-10T15:11:41.397514Z","shell.execute_reply":"2023-03-10T15:11:41.832858Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<h1>Test data analysis","metadata":{"execution":{"iopub.status.busy":"2023-03-10T15:16:00.956180Z","iopub.execute_input":"2023-03-10T15:16:00.956615Z","iopub.status.idle":"2023-03-10T15:16:00.962030Z","shell.execute_reply.started":"2023-03-10T15:16:00.956577Z","shell.execute_reply":"2023-03-10T15:16:00.960899Z"}}},{"cell_type":"code","source":"os.listdir(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/test\")","metadata":{"execution":{"iopub.status.busy":"2023-03-10T15:17:18.954793Z","iopub.execute_input":"2023-03-10T15:17:18.955241Z","iopub.status.idle":"2023-03-10T15:17:18.964466Z","shell.execute_reply.started":"2023-03-10T15:17:18.955202Z","shell.execute_reply":"2023-03-10T15:17:18.963218Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-03-10T15:18:14.431453Z","iopub.execute_input":"2023-03-10T15:18:14.431877Z","iopub.status.idle":"2023-03-10T15:18:14.459587Z","shell.execute_reply.started":"2023-03-10T15:18:14.431838Z","shell.execute_reply":"2023-03-10T15:18:14.458237Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\ntest_tdcsfog_example_df.head(10)","metadata":{"execution":{"iopub.status.busy":"2023-03-10T15:18:58.086835Z","iopub.execute_input":"2023-03-10T15:18:58.087278Z","iopub.status.idle":"2023-03-10T15:18:58.101471Z","shell.execute_reply.started":"2023-03-10T15:18:58.087241Z","shell.execute_reply":"2023-03-10T15:18:58.099825Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_tdcsfog_example_df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-03-10T15:19:21.022164Z","iopub.execute_input":"2023-03-10T15:19:21.022671Z","iopub.status.idle":"2023-03-10T15:19:21.051990Z","shell.execute_reply.started":"2023-03-10T15:19:21.022611Z","shell.execute_reply":"2023-03-10T15:19:21.050576Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"corr = test_tdcsfog_example_df.corr()","metadata":{"execution":{"iopub.status.busy":"2023-03-10T15:20:41.650313Z","iopub.execute_input":"2023-03-10T15:20:41.651106Z","iopub.status.idle":"2023-03-10T15:20:41.660396Z","shell.execute_reply.started":"2023-03-10T15:20:41.651037Z","shell.execute_reply":"2023-03-10T15:20:41.658730Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.heatmap(corr, cmap='coolwarm', annot=True, fmt=\".2f\", linewidths=0.5)","metadata":{"execution":{"iopub.status.busy":"2023-03-10T15:21:28.388461Z","iopub.execute_input":"2023-03-10T15:21:28.389370Z","iopub.status.idle":"2023-03-10T15:21:28.711878Z","shell.execute_reply.started":"2023-03-10T15:21:28.389319Z","shell.execute_reply":"2023-03-10T15:21:28.710608Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<h2>defog_metadata ","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-03-10T16:52:04.425032Z","iopub.execute_input":"2023-03-10T16:52:04.425458Z","iopub.status.idle":"2023-03-10T16:52:04.447657Z","shell.execute_reply.started":"2023-03-10T16:52:04.425419Z","shell.execute_reply":"2023-03-10T16:52:04.446628Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"defog_metadata_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-10T16:52:22.997413Z","iopub.execute_input":"2023-03-10T16:52:22.997825Z","iopub.status.idle":"2023-03-10T16:52:23.030560Z","shell.execute_reply.started":"2023-03-10T16:52:22.997789Z","shell.execute_reply":"2023-03-10T16:52:23.029156Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"defog_metadata_df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-03-10T16:52:39.575712Z","iopub.execute_input":"2023-03-10T16:52:39.576151Z","iopub.status.idle":"2023-03-10T16:52:39.606290Z","shell.execute_reply.started":"2023-03-10T16:52:39.576111Z","shell.execute_reply":"2023-03-10T16:52:39.605339Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"defog_metadata_df.columns ","metadata":{"execution":{"iopub.status.busy":"2023-03-10T16:53:05.709234Z","iopub.execute_input":"2023-03-10T16:53:05.709660Z","iopub.status.idle":"2023-03-10T16:53:05.718243Z","shell.execute_reply.started":"2023-03-10T16:53:05.709622Z","shell.execute_reply":"2023-03-10T16:53:05.716786Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"defog_metadata_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-03-10T16:53:51.248324Z","iopub.execute_input":"2023-03-10T16:53:51.248720Z","iopub.status.idle":"2023-03-10T16:53:51.258107Z","shell.execute_reply.started":"2023-03-10T16:53:51.248684Z","shell.execute_reply":"2023-03-10T16:53:51.256939Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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()\n","metadata":{"execution":{"iopub.status.busy":"2023-03-10T16:54:29.553155Z","iopub.execute_input":"2023-03-10T16:54:29.553646Z","iopub.status.idle":"2023-03-10T16:54:31.737333Z","shell.execute_reply.started":"2023-03-10T16:54:29.553599Z","shell.execute_reply":"2023-03-10T16:54:31.736071Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"defog_visit_counts = defog_metadata_df.Medication.value_counts()\n\nfig = px.bar(x=defog_visit_counts.index, y=defog_visit_counts.values)\nfig.update_layout(xaxis_title=\"Medication\", yaxis_title=\"Count\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-10T16:56:42.223589Z","iopub.execute_input":"2023-03-10T16:56:42.224122Z","iopub.status.idle":"2023-03-10T16:56:42.283901Z","shell.execute_reply.started":"2023-03-10T16:56:42.224076Z","shell.execute_reply":"2023-03-10T16:56:42.282584Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<h1>Daily metadata analysis ","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-03-10T16:58:51.818872Z","iopub.execute_input":"2023-03-10T16:58:51.819310Z","iopub.status.idle":"2023-03-10T16:58:51.834254Z","shell.execute_reply.started":"2023-03-10T16:58:51.819270Z","shell.execute_reply":"2023-03-10T16:58:51.833012Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"daily_metadata_df.head(10)","metadata":{"execution":{"iopub.status.busy":"2023-03-10T16:59:17.745327Z","iopub.execute_input":"2023-03-10T16:59:17.745801Z","iopub.status.idle":"2023-03-10T16:59:17.758829Z","shell.execute_reply.started":"2023-03-10T16:59:17.745758Z","shell.execute_reply":"2023-03-10T16:59:17.757910Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"daily_metadata_df.columns","metadata":{"execution":{"iopub.status.busy":"2023-03-10T16:59:59.416220Z","iopub.execute_input":"2023-03-10T16:59:59.416680Z","iopub.status.idle":"2023-03-10T16:59:59.423790Z","shell.execute_reply.started":"2023-03-10T16:59:59.416637Z","shell.execute_reply":"2023-03-10T16:59:59.423004Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"daily_metadata_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-03-10T17:03:55.066704Z","iopub.execute_input":"2023-03-10T17:03:55.067163Z","iopub.status.idle":"2023-03-10T17:03:55.078531Z","shell.execute_reply.started":"2023-03-10T17:03:55.067123Z","shell.execute_reply":"2023-03-10T17:03:55.077171Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"daily_metadata_df.isnull()","metadata":{"execution":{"iopub.status.busy":"2023-03-10T17:04:15.487443Z","iopub.execute_input":"2023-03-10T17:04:15.488927Z","iopub.status.idle":"2023-03-10T17:04:15.507544Z","shell.execute_reply.started":"2023-03-10T17:04:15.488832Z","shell.execute_reply":"2023-03-10T17:04:15.505915Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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()\n\n","metadata":{"execution":{"iopub.status.busy":"2023-03-10T17:05:11.212363Z","iopub.execute_input":"2023-03-10T17:05:11.212819Z","iopub.status.idle":"2023-03-10T17:05:11.281085Z","shell.execute_reply.started":"2023-03-10T17:05:11.212776Z","shell.execute_reply":"2023-03-10T17:05:11.279759Z"},"trusted":true},"execution_count":null,"outputs":[]}]}