{"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 tqdm\nimport glob\nimport numpy as np\nimport pandas as pd","metadata":{"_uuid":"0549e9be-a112-499c-9ea4-d1572fc3c91c","_cell_guid":"bd56a6df-6041-4529-92c5-05a435603fa8","collapsed":false,"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# parent directory\npdir = '/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction'","metadata":{"_uuid":"2196131a-5746-46bb-be50-cda74634e26a","_cell_guid":"68bb70a7-5168-480e-ac47-58c0b4c1d4c0","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:21:06.796119Z","iopub.execute_input":"2023-04-20T15:21:06.797196Z","iopub.status.idle":"2023-04-20T15:21:06.801564Z","shell.execute_reply.started":"2023-04-20T15:21:06.797153Z","shell.execute_reply":"2023-04-20T15:21:06.800600Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_tdcs_meta = pd.read_csv(os.path.join(pdir, 'tdcsfog_metadata.csv'))\ndf_tdcs_meta.head()","metadata":{"_uuid":"5de3cc90-900d-46e0-a429-e6d7d0d56563","_cell_guid":"c7e79e61-783b-4519-b49a-30a234bddff6","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:21:04.967462Z","iopub.execute_input":"2023-04-20T15:21:04.967865Z","iopub.status.idle":"2023-04-20T15:21:05.019765Z","shell.execute_reply.started":"2023-04-20T15:21:04.967832Z","shell.execute_reply":"2023-04-20T15:21:05.018303Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_defog_meta = pd.read_csv(os.path.join(pdir, 'defog_metadata.csv'))\ndf_defog_meta.head()\n\ndf_subjects = pd.read_csv(os.path.join(pdir, 'subjects.csv'))\ndf_subjects.head()","metadata":{"_uuid":"49dffe7d-2b15-46a8-aad9-194a7d7295d7","_cell_guid":"89d4fb2d-cebe-4770-81c5-0c23963de29e","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:21:09.333397Z","iopub.execute_input":"2023-04-20T15:21:09.333830Z","iopub.status.idle":"2023-04-20T15:21:09.362749Z","shell.execute_reply.started":"2023-04-20T15:21:09.333791Z","shell.execute_reply":"2023-04-20T15:21:09.361606Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# load tdcsfog data\n# list of all tdcsfog csv file path\ntdcs_file_path = glob.glob(os.path.join(pdir, 'train', 'tdcsfog', '*.csv'), recursive=True)\n\n# In this notebook, we limit the number of files to be read in order to reduce the time required for model training.\ntdcs_file_path = tdcs_file_path[::100]\n\nprint(f'the number of files to be read: {len(tdcs_file_path)}')","metadata":{"_uuid":"122ff7ef-77f3-48de-9c41-4d70a556358a","_cell_guid":"36d3eeed-7074-46e5-8312-16581a3d0750","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:21:29.436859Z","iopub.execute_input":"2023-04-20T15:21:29.437323Z","iopub.status.idle":"2023-04-20T15:21:29.519657Z","shell.execute_reply.started":"2023-04-20T15:21:29.437285Z","shell.execute_reply":"2023-04-20T15:21:29.518278Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Initialize a DataFrame to combine data from multiple CSV files.\ndf_tdcs = pd.DataFrame()\n\n# load tdcsfog time series in combination with metadata.\nfor fp in tqdm.tqdm(tdcs_file_path):    \n    \n    # load data into a variable 'tmp'.\n    tmp = pd.read_csv(fp)\n    \n    # get file Id from csv file name.\n    file_id = os.path.basename(fp).replace(\".csv\", \"\")\n    \n    # get subject Id.\n    subject = df_tdcs_meta.loc[df_tdcs_meta['Id'] == file_id, 'Subject'].iloc[0]\n    \n    # add metadata.\n    tmp['Medication'] = df_tdcs_meta.loc[df_tdcs_meta['Id'] == file_id, 'Medication'].iloc[0]\n    tmp['Age'] = df_subjects.loc[df_subjects['Subject'] == subject, 'Age'].iloc[0]\n    tmp['Sex'] = df_subjects.loc[df_subjects['Subject'] == subject, 'Sex'].iloc[0]\n    tmp['YearsSinceDx'] = df_subjects.loc[df_subjects['Subject'] == subject, 'YearsSinceDx'].iloc[0]\n    tmp['NFOGQ'] =df_subjects.loc[df_subjects['Subject'] == subject, 'NFOGQ'].iloc[0]\n    \n    # concat the data\n    df_tdcs = pd.concat([df_tdcs, tmp]).reset_index(drop=True)","metadata":{"_uuid":"959929af-0416-49a8-ba19-3c782cba6b75","_cell_guid":"587ccc9c-9aa4-4e0d-8e0d-fde988fae76c","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:21:31.561806Z","iopub.execute_input":"2023-04-20T15:21:31.562984Z","iopub.status.idle":"2023-04-20T15:21:31.866656Z","shell.execute_reply.started":"2023-04-20T15:21:31.562940Z","shell.execute_reply":"2023-04-20T15:21:31.865287Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_tdcs.head()","metadata":{"_uuid":"7a76c6cd-1fd3-4514-acf8-bd04d409b71f","_cell_guid":"f1a70a00-f11c-48f1-9693-2be6be49545b","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:21:39.560785Z","iopub.execute_input":"2023-04-20T15:21:39.561934Z","iopub.status.idle":"2023-04-20T15:21:39.580151Z","shell.execute_reply.started":"2023-04-20T15:21:39.561891Z","shell.execute_reply":"2023-04-20T15:21:39.578812Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# load defog data\n# list of all tdcsfog csv file path\ndefog_file_path = glob.glob(os.path.join(pdir, 'train', 'defog', '*.csv'), recursive=True)\n\n# In this notebook, we limit the number of files to be read in order to reduce the time required for model training.\ndefog_file_path = defog_file_path[::50]\n\nprint(f'the number of files to be read: {len(defog_file_path)}')","metadata":{"_uuid":"3c67b582-2c33-4b4a-9b2c-6389186cafb6","_cell_guid":"87ef3063-051f-4ecd-b0e2-6d2aa12769b5","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:21:56.986071Z","iopub.execute_input":"2023-04-20T15:21:56.987350Z","iopub.status.idle":"2023-04-20T15:21:57.001702Z","shell.execute_reply.started":"2023-04-20T15:21:56.987301Z","shell.execute_reply":"2023-04-20T15:21:57.000793Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Initialize a DataFrame to combine data from multiple CSV files.\ndf_defog = pd.DataFrame()\n\nfor fp in tqdm.tqdm(defog_file_path):\n    # load data into a variable 'tmp'.\n    tmp = pd.read_csv(fp)\n    \n    # get file Id from csv file name.\n    file_id = os.path.basename(fp).replace(\".csv\", \"\")\n    \n    # get subject Id.\n    subject = df_defog_meta.loc[df_defog_meta['Id'] == file_id, 'Subject'].iloc[0]\n    \n    # add metadata.\n    tmp['Medication'] = df_defog_meta.loc[df_defog_meta['Id'] == file_id, 'Medication'].iloc[0]\n    tmp['Age'] = df_subjects.loc[df_subjects['Subject'] == subject, 'Age'].iloc[0]\n    tmp['Sex'] = df_subjects.loc[df_subjects['Subject'] == subject, 'Sex'].iloc[0]\n    tmp['YearsSinceDx'] = df_subjects.loc[df_subjects['Subject'] == subject, 'YearsSinceDx'].iloc[0]\n    tmp['NFOGQ'] =df_subjects.loc[df_subjects['Subject'] == subject, 'NFOGQ'].iloc[0]\n    \n    # extract data from the time period where Valid and Task are both True.\n    tmp = tmp[(tmp['Valid'] == True) & (tmp['Task']==True)]\n    tmp = tmp.drop(['Valid', 'Task'], axis=1)\n    \n    # concat the data\n    df_defog = pd.concat([df_defog, tmp]).reset_index(drop=True)","metadata":{"_uuid":"8725c2b6-a496-4e42-aaa9-b468b045bf89","_cell_guid":"33ca7a88-9330-468b-a2a7-8aea8c179047","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:22:05.837666Z","iopub.execute_input":"2023-04-20T15:22:05.838175Z","iopub.status.idle":"2023-04-20T15:22:06.421523Z","shell.execute_reply.started":"2023-04-20T15:22:05.838129Z","shell.execute_reply":"2023-04-20T15:22:06.420525Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# check the contents of the df_defog\ndf_defog.head()","metadata":{"_uuid":"b1dc546d-e781-4aa4-a647-df65ad15aa30","_cell_guid":"9f2155ce-2316-42c5-b948-478d340aa5d9","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:22:39.549845Z","iopub.execute_input":"2023-04-20T15:22:39.550267Z","iopub.status.idle":"2023-04-20T15:22:39.565647Z","shell.execute_reply.started":"2023-04-20T15:22:39.550230Z","shell.execute_reply":"2023-04-20T15:22:39.564874Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# prepare the training data\n# concat tdcs and defog data.\ndf_train = pd.concat([df_tdcs, df_defog]).reset_index(drop=True)\ndf_train.head()","metadata":{"_uuid":"3e8c59b1-26c8-4363-8c77-1b80e2be3795","_cell_guid":"4a3ad625-d594-4acd-b5f2-a5755c2590a1","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:22:41.850810Z","iopub.execute_input":"2023-04-20T15:22:41.852021Z","iopub.status.idle":"2023-04-20T15:22:41.895159Z","shell.execute_reply.started":"2023-04-20T15:22:41.851976Z","shell.execute_reply":"2023-04-20T15:22:41.893982Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# encode string columns into 0/1 format\ndf_train['Medication'] = np.where(df_train['Medication']=='on', 1, 0)\ndf_train['Sex'] = np.where(df_train['Sex']=='M', 1, 0)\ndf_train.head()","metadata":{"_uuid":"ecb40426-38e4-4b94-b519-62a9504e006f","_cell_guid":"19a02577-4bea-42cc-9580-9b7350cf3373","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:22:43.795197Z","iopub.execute_input":"2023-04-20T15:22:43.795680Z","iopub.status.idle":"2023-04-20T15:22:43.831735Z","shell.execute_reply.started":"2023-04-20T15:22:43.795644Z","shell.execute_reply":"2023-04-20T15:22:43.830475Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# split data into features and target.\ny = df_train[['StartHesitation', 'Turn', 'Walking']]                       # target\nX = df_train.drop(['StartHesitation', 'Turn', 'Walking', 'Time'], axis=1)  # feature","metadata":{"_uuid":"f7959f11-7e58-472b-a10f-8b3490adeb03","_cell_guid":"ec0fe77a-0fc0-4fb5-bc05-7c34344f0d92","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:32:20.121843Z","iopub.execute_input":"2023-04-20T15:32:20.123518Z","iopub.status.idle":"2023-04-20T15:32:20.133170Z","shell.execute_reply.started":"2023-04-20T15:32:20.123461Z","shell.execute_reply":"2023-04-20T15:32:20.132244Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# train random forest\n\n\n# train the model with default parameter\nrf = RandomForestClassifier(random_state=0)\nrf.fit(X, y)","metadata":{"_uuid":"3024d062-4df8-4d33-863f-1ad1b8cca545","_cell_guid":"f76cc607-ee02-423c-acf5-ad112ae99c2e","execution":{"iopub.status.busy":"2023-04-20T15:23:33.233731Z","iopub.execute_input":"2023-04-20T15:23:33.234160Z","iopub.status.idle":"2023-04-20T15:23:57.236348Z","shell.execute_reply.started":"2023-04-20T15:23:33.234125Z","shell.execute_reply":"2023-04-20T15:23:57.235273Z"},"trusted":true}},{"cell_type":"code","source":"from xgboost import XGBClassifier\n\nxgb = XGBClassifier(n_estimators=100)\nxgb.fit(X,y)","metadata":{"_uuid":"4ea773d9-05f7-4fe2-b76e-84faf68bac9a","_cell_guid":"1dcfc42c-9cb1-4e32-9130-0ace6151ddf7","collapsed":false,"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# list of all tdcsfog csv file path\ntdcs_test_file_path = glob.glob(os.path.join(pdir, 'test', 'tdcsfog', '*.csv'), recursive=True)\nprint(f'the number of files to be read: {len(tdcs_test_file_path)}')","metadata":{"_uuid":"06a128bf-0523-41af-aa76-8a7b4e3c783c","_cell_guid":"63f1ec77-ed4d-496f-9bb0-88dd63899cfd","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:23:57.238031Z","iopub.execute_input":"2023-04-20T15:23:57.238389Z","iopub.status.idle":"2023-04-20T15:23:57.248685Z","shell.execute_reply.started":"2023-04-20T15:23:57.238356Z","shell.execute_reply":"2023-04-20T15:23:57.247334Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Initialize a DataFrame to combine data from multiple CSV files.\ndf_tdcs_test = pd.DataFrame()\n\nfor fp in tqdm.tqdm(tdcs_test_file_path):\n    \n    # load data into a variable 'tmp'.\n    tmp = pd.read_csv(fp)\n    \n    # get file Id from csv file name.\n    file_id = os.path.basename(fp).replace(\".csv\", \"\")\n    \n    # get subject Id.\n    subject = df_tdcs_meta.loc[df_tdcs_meta['Id'] == file_id, 'Subject'].iloc[0]\n    \n    # add metadata.\n    tmp['Medication'] = df_tdcs_meta.loc[df_tdcs_meta['Id'] == file_id, 'Medication'].iloc[0]\n    tmp['Age'] = df_subjects.loc[df_subjects['Subject'] == subject, 'Age'].iloc[0]\n    tmp['Sex'] = df_subjects.loc[df_subjects['Subject'] == subject, 'Sex'].iloc[0]\n    tmp['YearsSinceDx'] = df_subjects.loc[df_subjects['Subject'] == subject, 'YearsSinceDx'].iloc[0]\n    tmp['NFOGQ'] =df_subjects.loc[df_subjects['Subject'] == subject, 'NFOGQ'].iloc[0]\n    \n    # add Id data to submit.\n    tmp['Id'] = file_id + '_' + tmp['Time'].astype(str)\n    \n    # concat the data\n    df_tdcs_test = pd.concat([df_tdcs_test, tmp]).reset_index(drop=True)","metadata":{"_uuid":"61452058-41bb-43f5-9dc6-f494ce981114","_cell_guid":"a091c4eb-eaac-46d5-8cb5-943dcdc3a625","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:23:57.250242Z","iopub.execute_input":"2023-04-20T15:23:57.250598Z","iopub.status.idle":"2023-04-20T15:23:57.286987Z","shell.execute_reply.started":"2023-04-20T15:23:57.250563Z","shell.execute_reply":"2023-04-20T15:23:57.285872Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# check the contents of the df_tdcs_test\ndf_tdcs_test.head()","metadata":{"_uuid":"2d20aaed-f4e8-46c9-a039-4193f8c3e817","_cell_guid":"66d73c09-0721-47e6-ab1b-ac23f312a2dd","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:24:41.361717Z","iopub.execute_input":"2023-04-20T15:24:41.362122Z","iopub.status.idle":"2023-04-20T15:24:41.378529Z","shell.execute_reply.started":"2023-04-20T15:24:41.362087Z","shell.execute_reply":"2023-04-20T15:24:41.377288Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# list of all tdcsfog csv file path\ndefog_test_file_path = glob.glob(os.path.join(pdir, 'test', 'defog', '*.csv'), recursive=True)\nprint(f'the number of files to be read: {len(defog_test_file_path)}')","metadata":{"_uuid":"49d9a731-5938-4ec4-abf0-a4f594602def","_cell_guid":"d7ef91b4-afaa-4c39-833f-86dec7c121b3","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:24:43.126406Z","iopub.execute_input":"2023-04-20T15:24:43.126845Z","iopub.status.idle":"2023-04-20T15:24:43.134955Z","shell.execute_reply.started":"2023-04-20T15:24:43.126806Z","shell.execute_reply":"2023-04-20T15:24:43.133710Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Initialize a DataFrame to combine data from multiple CSV files.\ndf_defog_test = pd.DataFrame()\n\nfor fp in tqdm.tqdm(defog_test_file_path):\n    # load data into a variable 'tmp'.\n    tmp = pd.read_csv(fp)\n    \n    # get file Id from csv file name.\n    file_id = os.path.basename(fp).replace(\".csv\", \"\")\n    \n    # get subject Id.\n    subject = df_defog_meta.loc[df_defog_meta['Id'] == file_id, 'Subject'].iloc[0]\n    \n    # add metadata.\n    tmp['Medication'] = df_defog_meta.loc[df_defog_meta['Id'] == file_id, 'Medication'].iloc[0]\n    tmp['Age'] = df_subjects.loc[df_subjects['Subject'] == subject, 'Age'].iloc[0]\n    tmp['Sex'] = df_subjects.loc[df_subjects['Subject'] == subject, 'Sex'].iloc[0]\n    tmp['YearsSinceDx'] = df_subjects.loc[df_subjects['Subject'] == subject, 'YearsSinceDx'].iloc[0]\n    tmp['NFOGQ'] =df_subjects.loc[df_subjects['Subject'] == subject, 'NFOGQ'].iloc[0]\n    \n    # add Id data to submit.\n    tmp['Id'] = file_id + '_' + tmp['Time'].astype(str)\n    \n    # concat the data\n    df_defog_test = pd.concat([df_defog_test, tmp]).reset_index(drop=True)","metadata":{"_uuid":"4d20bd59-3751-4bb2-9a46-730f126e722b","_cell_guid":"82d585d6-7cee-4be7-b786-db3d33ceaa1c","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:24:45.111118Z","iopub.execute_input":"2023-04-20T15:24:45.111965Z","iopub.status.idle":"2023-04-20T15:24:45.866345Z","shell.execute_reply.started":"2023-04-20T15:24:45.111915Z","shell.execute_reply":"2023-04-20T15:24:45.865082Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# check the contents of the df_defog_test\ndf_defog_test.head()","metadata":{"_uuid":"b5d3230b-d071-4411-9dce-93268c69fcd1","_cell_guid":"d4bb3d50-9bd7-4f79-bb1d-1147575cccbc","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:24:49.631461Z","iopub.execute_input":"2023-04-20T15:24:49.631882Z","iopub.status.idle":"2023-04-20T15:24:49.649061Z","shell.execute_reply.started":"2023-04-20T15:24:49.631849Z","shell.execute_reply":"2023-04-20T15:24:49.647673Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# concat tdcs and defog data.\ndf_test = pd.concat([df_tdcs_test, df_defog_test]).reset_index(drop=True)\n\n# encode string columns into 0/1 format\ndf_test['Medication'] = np.where(df_test['Medication']=='on', 1, 0)\ndf_test['Sex'] = np.where(df_test['Sex']=='M', 1, 0)\ndisplay(df_test)","metadata":{"_uuid":"02b24e1e-5c4b-4607-9d49-d3bdafcd74bd","_cell_guid":"f534027c-a1a8-46a9-9049-4db463f1bae6","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:24:52.089759Z","iopub.execute_input":"2023-04-20T15:24:52.090382Z","iopub.status.idle":"2023-04-20T15:24:52.272891Z","shell.execute_reply.started":"2023-04-20T15:24:52.090326Z","shell.execute_reply":"2023-04-20T15:24:52.271649Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# split data into submission Id and feature.\nId = df_test['Id']                             # Id for submission data\nX_test = df_test.drop(['Time', 'Id'], axis=1)  # feature of test data\nX_test.head()","metadata":{"_uuid":"608e9233-0f63-4036-881b-72e545085799","_cell_guid":"a648ca8a-c0ed-4759-87f4-f0f6cead2935","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:24:54.737163Z","iopub.execute_input":"2023-04-20T15:24:54.738203Z","iopub.status.idle":"2023-04-20T15:24:54.763316Z","shell.execute_reply.started":"2023-04-20T15:24:54.738142Z","shell.execute_reply":"2023-04-20T15:24:54.762128Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# calculate prediction using trained RandomForestClassifier model.\nprediction = xgb.predict(X_test)","metadata":{"_uuid":"e59f8bff-f981-436b-87f1-5defadedc402","_cell_guid":"76189a00-af78-413f-af4c-2f7fba2e112d","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:24:56.472052Z","iopub.execute_input":"2023-04-20T15:24:56.472743Z","iopub.status.idle":"2023-04-20T15:25:01.603835Z","shell.execute_reply.started":"2023-04-20T15:24:56.472698Z","shell.execute_reply":"2023-04-20T15:25:01.602774Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Prepare submit data\nsubmit = pd.DataFrame(Id, columns=['Id'])\nsubmit['StartHesitation'] = prediction[:, 0]\nsubmit['Turn'] = prediction[:, 1]\nsubmit['Walking'] = prediction[:, 2]","metadata":{"_uuid":"d238bfd9-9c0b-47cd-b5f2-a45e945eecbd","_cell_guid":"f6740d35-e645-4c15-ac2e-c87e658782b3","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:25:18.104845Z","iopub.execute_input":"2023-04-20T15:25:18.105281Z","iopub.status.idle":"2023-04-20T15:25:18.120715Z","shell.execute_reply.started":"2023-04-20T15:25:18.105244Z","shell.execute_reply":"2023-04-20T15:25:18.119655Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"display(submit)","metadata":{"_uuid":"7e6ea758-7414-4ed8-b433-526e44810134","_cell_guid":"b96670ad-502a-4e1b-b0ca-a23fa578e9cf","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:25:19.967265Z","iopub.execute_input":"2023-04-20T15:25:19.968063Z","iopub.status.idle":"2023-04-20T15:25:19.982982Z","shell.execute_reply.started":"2023-04-20T15:25:19.968022Z","shell.execute_reply":"2023-04-20T15:25:19.981736Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Save the created submission data.\nsubmit.to_csv('submission.csv', index=False)","metadata":{"_uuid":"f259e4b4-9a82-4ab4-8b08-4c4bdc8e0e34","_cell_guid":"7a869a75-d947-4a60-aea0-4f8b8f4cb05c","collapsed":false,"execution":{"iopub.status.busy":"2023-04-20T15:25:22.885498Z","iopub.execute_input":"2023-04-20T15:25:22.885900Z","iopub.status.idle":"2023-04-20T15:25:23.313785Z","shell.execute_reply.started":"2023-04-20T15:25:22.885865Z","shell.execute_reply":"2023-04-20T15:25:23.312605Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]}]}