{"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":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-04-16T23:29:42.876075Z","iopub.execute_input":"2023-04-16T23:29:42.876611Z","iopub.status.idle":"2023-04-16T23:29:43.070251Z","shell.execute_reply.started":"2023-04-16T23:29:42.876574Z","shell.execute_reply":"2023-04-16T23:29:43.069355Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport os\nfrom sklearn import *\nimport glob","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:29:43.071932Z","iopub.execute_input":"2023-04-16T23:29:43.072497Z","iopub.status.idle":"2023-04-16T23:29:44.856249Z","shell.execute_reply.started":"2023-04-16T23:29:43.072461Z","shell.execute_reply":"2023-04-16T23:29:44.854962Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dmetadata = pd.read_csv(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/daily_metadata.csv\")\ndefog = pd.read_csv(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/defog_metadata.csv\")\nevents = pd.read_csv(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/events.csv\")\nsubjects = pd.read_csv(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/subjects.csv\")\ntasks = pd.read_csv(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/tasks.csv\")\ntdcs = pd.read_csv(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/tdcsfog_metadata.csv\")\ntdcsfog = pd.read_csv(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/tdcsfog_metadata.csv\")\n\ntrain = glob.glob(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/train\")\ntest = glob.glob(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/test\")","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:29:44.857603Z","iopub.execute_input":"2023-04-16T23:29:44.860916Z","iopub.status.idle":"2023-04-16T23:29:44.919685Z","shell.execute_reply.started":"2023-04-16T23:29:44.860876Z","shell.execute_reply":"2023-04-16T23:29:44.918607Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata=pd.concat([defog,tdcsfog])\nmetadata","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:29:44.922601Z","iopub.execute_input":"2023-04-16T23:29:44.923536Z","iopub.status.idle":"2023-04-16T23:29:44.969401Z","shell.execute_reply.started":"2023-04-16T23:29:44.923488Z","shell.execute_reply":"2023-04-16T23:29:44.968414Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata.replace('on',1,inplace=True)\nmetadata.replace('off',0,inplace=True)\nmetadata","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:29:44.970900Z","iopub.execute_input":"2023-04-16T23:29:44.971241Z","iopub.status.idle":"2023-04-16T23:29:44.990942Z","shell.execute_reply.started":"2023-04-16T23:29:44.971208Z","shell.execute_reply":"2023-04-16T23:29:44.989721Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata_new=metadata.merge(subjects,how='left',on='Subject').copy()\nmetadata_new","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:29:44.993526Z","iopub.execute_input":"2023-04-16T23:29:44.993964Z","iopub.status.idle":"2023-04-16T23:29:45.036686Z","shell.execute_reply.started":"2023-04-16T23:29:44.993918Z","shell.execute_reply":"2023-04-16T23:29:45.035546Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata_new.fillna(0,inplace=True)\nmetadata_new","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:29:45.038045Z","iopub.execute_input":"2023-04-16T23:29:45.038558Z","iopub.status.idle":"2023-04-16T23:29:45.065335Z","shell.execute_reply.started":"2023-04-16T23:29:45.038515Z","shell.execute_reply":"2023-04-16T23:29:45.064261Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata_new.replace('M',1,inplace=True)\nmetadata_new.replace('F',0,inplace=True)\nmetadata_new","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:29:45.066817Z","iopub.execute_input":"2023-04-16T23:29:45.067192Z","iopub.status.idle":"2023-04-16T23:29:45.098539Z","shell.execute_reply.started":"2023-04-16T23:29:45.067163Z","shell.execute_reply":"2023-04-16T23:29:45.097441Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"bins = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]\nlabels = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\nmetadata_new['Age_Category'] = pd.cut(metadata_new['Age'], bins,labels = labels)\nmetadata_new","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:29:45.099852Z","iopub.execute_input":"2023-04-16T23:29:45.103367Z","iopub.status.idle":"2023-04-16T23:29:45.137279Z","shell.execute_reply.started":"2023-04-16T23:29:45.103329Z","shell.execute_reply":"2023-04-16T23:29:45.136344Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"bins = [0, 5, 10, 15, 20, 25, 30, 35]\nlabels = [0, 1, 2, 3, 4, 5, 6]\nmetadata_new['YearsSinceDx_Category'] = pd.cut(metadata_new['YearsSinceDx'], bins,labels = labels)\nmetadata_new","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:29:45.141556Z","iopub.execute_input":"2023-04-16T23:29:45.141888Z","iopub.status.idle":"2023-04-16T23:29:45.175138Z","shell.execute_reply.started":"2023-04-16T23:29:45.141855Z","shell.execute_reply":"2023-04-16T23:29:45.173955Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata_new = metadata_new.drop(['YearsSinceDx', 'Age'], axis = 1)\nmetadata_new","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:29:45.176767Z","iopub.execute_input":"2023-04-16T23:29:45.178600Z","iopub.status.idle":"2023-04-16T23:29:45.205874Z","shell.execute_reply.started":"2023-04-16T23:29:45.178552Z","shell.execute_reply":"2023-04-16T23:29:45.204638Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_defog = glob.glob('/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/train/defog/**')\ntrain_tdcsfog = glob.glob('/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/train/tdcsfog/**')","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:29:45.207102Z","iopub.execute_input":"2023-04-16T23:29:45.207460Z","iopub.status.idle":"2023-04-16T23:29:45.216724Z","shell.execute_reply.started":"2023-04-16T23:29:45.207427Z","shell.execute_reply":"2023-04-16T23:29:45.215671Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_defog","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:29:45.218860Z","iopub.execute_input":"2023-04-16T23:29:45.220187Z","iopub.status.idle":"2023-04-16T23:29:45.228545Z","shell.execute_reply.started":"2023-04-16T23:29:45.220138Z","shell.execute_reply":"2023-04-16T23:29:45.227608Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def get_data(f):\n    df = pd.read_csv(f)\n    df['Id'] = f.split('/')[-1].split('.')[0]\n    df['data_type'] = f.split('/')[-2]\n    return df","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:29:45.230180Z","iopub.execute_input":"2023-04-16T23:29:45.230513Z","iopub.status.idle":"2023-04-16T23:29:45.236450Z","shell.execute_reply.started":"2023-04-16T23:29:45.230481Z","shell.execute_reply":"2023-04-16T23:29:45.235326Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train_defog = pd.concat([get_data(f) for f in train_defog])\ndf_train_tdcsfog = pd.concat([get_data(f) for f in train_tdcsfog])","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:29:45.237642Z","iopub.execute_input":"2023-04-16T23:29:45.237939Z","iopub.status.idle":"2023-04-16T23:30:25.060730Z","shell.execute_reply.started":"2023-04-16T23:29:45.237909Z","shell.execute_reply":"2023-04-16T23:30:25.059692Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train_defog","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:30:25.062062Z","iopub.execute_input":"2023-04-16T23:30:25.062387Z","iopub.status.idle":"2023-04-16T23:30:25.082945Z","shell.execute_reply.started":"2023-04-16T23:30:25.062356Z","shell.execute_reply":"2023-04-16T23:30:25.081801Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def convert_time(df, freq):\n    if freq == 100:\n        df['Time'] /= 100\n        df['Time'] = round(df['Time'], 3)\n    elif freq ==128:\n        df['Time'] = round(df['Time'] / 128, )\n    return df","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:30:25.084470Z","iopub.execute_input":"2023-04-16T23:30:25.084890Z","iopub.status.idle":"2023-04-16T23:30:25.093607Z","shell.execute_reply.started":"2023-04-16T23:30:25.084846Z","shell.execute_reply":"2023-04-16T23:30:25.092343Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train_defog = convert_time(df_train_defog, 100)\ndf_train_tdcsfog = convert_time(df_train_tdcsfog, 128)","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:30:25.095046Z","iopub.execute_input":"2023-04-16T23:30:25.095371Z","iopub.status.idle":"2023-04-16T23:30:25.340525Z","shell.execute_reply.started":"2023-04-16T23:30:25.095341Z","shell.execute_reply":"2023-04-16T23:30:25.339514Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train_defog","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:30:25.342300Z","iopub.execute_input":"2023-04-16T23:30:25.342629Z","iopub.status.idle":"2023-04-16T23:30:25.362712Z","shell.execute_reply.started":"2023-04-16T23:30:25.342597Z","shell.execute_reply":"2023-04-16T23:30:25.361527Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def convert_acc(df):\n    df['AccV'] *= 9.80665\n    df['AccML'] *= 9.80665\n    df['AccAP'] *= 9.80665\n    return df","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:30:25.363948Z","iopub.execute_input":"2023-04-16T23:30:25.364257Z","iopub.status.idle":"2023-04-16T23:30:25.371745Z","shell.execute_reply.started":"2023-04-16T23:30:25.364227Z","shell.execute_reply":"2023-04-16T23:30:25.370661Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train_defog = convert_acc(df_train_defog)","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:30:25.372983Z","iopub.execute_input":"2023-04-16T23:30:25.373281Z","iopub.status.idle":"2023-04-16T23:30:25.675023Z","shell.execute_reply.started":"2023-04-16T23:30:25.373250Z","shell.execute_reply":"2023-04-16T23:30:25.673829Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train = pd.concat([df_train_defog,df_train_tdcsfog])","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:30:25.676371Z","iopub.execute_input":"2023-04-16T23:30:25.676712Z","iopub.status.idle":"2023-04-16T23:30:28.302463Z","shell.execute_reply.started":"2023-04-16T23:30:25.676680Z","shell.execute_reply":"2023-04-16T23:30:28.301508Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.fillna(0)","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:30:28.304398Z","iopub.execute_input":"2023-04-16T23:30:28.304836Z","iopub.status.idle":"2023-04-16T23:30:41.587464Z","shell.execute_reply.started":"2023-04-16T23:30:28.304791Z","shell.execute_reply":"2023-04-16T23:30:41.586342Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(df_train.dtypes)","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:30:41.588904Z","iopub.execute_input":"2023-04-16T23:30:41.589224Z","iopub.status.idle":"2023-04-16T23:30:41.595406Z","shell.execute_reply.started":"2023-04-16T23:30:41.589194Z","shell.execute_reply":"2023-04-16T23:30:41.594339Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"new_df = df_train.merge(metadata_new,how='left', on='Id').copy()","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:30:41.596702Z","iopub.execute_input":"2023-04-16T23:30:41.597075Z","iopub.status.idle":"2023-04-16T23:31:03.980372Z","shell.execute_reply.started":"2023-04-16T23:30:41.597043Z","shell.execute_reply":"2023-04-16T23:31:03.979317Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"new_df['data_type'] = np.where(new_df['data_type'] != 'defog', 0, 1)","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:31:03.981822Z","iopub.execute_input":"2023-04-16T23:31:03.982278Z","iopub.status.idle":"2023-04-16T23:31:08.455307Z","shell.execute_reply.started":"2023-04-16T23:31:03.982229Z","shell.execute_reply":"2023-04-16T23:31:08.454324Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"new_df.drop(['Valid', 'Task', 'NFOGQ'], axis=1)","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:31:08.457085Z","iopub.execute_input":"2023-04-16T23:31:08.457425Z","iopub.status.idle":"2023-04-16T23:31:11.719923Z","shell.execute_reply.started":"2023-04-16T23:31:08.457394Z","shell.execute_reply":"2023-04-16T23:31:11.719022Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Features = ['Time', 'AccV', 'AccML', 'AccAP', 'Age_Category', \"Sex\", 'Medication', 'YearsSinceDx_Category', 'data_type', 'UPDRSIII_On', 'UPDRSIII_Off']\n#Targets = ['StartHesitation', 'Turn', 'Walking']","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:31:11.725397Z","iopub.execute_input":"2023-04-16T23:31:11.725706Z","iopub.status.idle":"2023-04-16T23:31:11.729559Z","shell.execute_reply.started":"2023-04-16T23:31:11.725676Z","shell.execute_reply":"2023-04-16T23:31:11.728446Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Features = ['Time', 'AccAP', 'Age_Category', 'Medication', 'YearsSinceDx_Category', 'data_type', 'UPDRSIII_On', 'UPDRSIII_Off']\nTargets = ['StartHesitation', 'Turn', 'Walking']","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:31:11.730670Z","iopub.execute_input":"2023-04-16T23:31:11.730941Z","iopub.status.idle":"2023-04-16T23:31:11.740984Z","shell.execute_reply.started":"2023-04-16T23:31:11.730914Z","shell.execute_reply":"2023-04-16T23:31:11.739931Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"conditions = [\n    (new_df['StartHesitation'] == 1),\n    (new_df['Turn'] == 1),\n    (new_df['Walking'] == 1)]\nchoices = ['StartHesitation', 'Turn', 'Walking']\nnew_df['event'] = np.select(conditions, choices, default='Normal')","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:31:11.742088Z","iopub.execute_input":"2023-04-16T23:31:11.742395Z","iopub.status.idle":"2023-04-16T23:31:18.162796Z","shell.execute_reply.started":"2023-04-16T23:31:11.742364Z","shell.execute_reply":"2023-04-16T23:31:18.161474Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"new_df['event'].value_counts().to_frame().style.background_gradient()","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:31:18.164342Z","iopub.execute_input":"2023-04-16T23:31:18.165515Z","iopub.status.idle":"2023-04-16T23:31:20.916605Z","shell.execute_reply.started":"2023-04-16T23:31:18.165466Z","shell.execute_reply":"2023-04-16T23:31:20.915173Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_train, x_valid, y_train, y_valid = model_selection.train_test_split(new_df[Features], new_df[Targets], test_size=.30, random_state=42)","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:31:20.918128Z","iopub.execute_input":"2023-04-16T23:31:20.918900Z","iopub.status.idle":"2023-04-16T23:31:34.235307Z","shell.execute_reply.started":"2023-04-16T23:31:20.918862Z","shell.execute_reply":"2023-04-16T23:31:34.234319Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.ensemble import RandomForestClassifier\nfrom sklearn.tree import DecisionTreeClassifier","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:31:34.243490Z","iopub.execute_input":"2023-04-16T23:31:34.243839Z","iopub.status.idle":"2023-04-16T23:31:34.250571Z","shell.execute_reply.started":"2023-04-16T23:31:34.243802Z","shell.execute_reply":"2023-04-16T23:31:34.249355Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_train, x_valid, y_train, y_valid = model_selection.train_test_split(new_df[Features], new_df[Targets], test_size=.30, random_state=42)\nrf = ensemble.RandomForestRegressor(max_depth = 10, min_samples_leaf = 1, min_samples_split = 2, n_estimators = 125, max_features = 'sqrt', random_state = 42, n_jobs = -1)\nrf.fit(x_train, y_train)","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:31:34.278052Z","iopub.execute_input":"2023-04-16T23:31:34.279664Z","iopub.status.idle":"2023-04-16T23:56:27.532284Z","shell.execute_reply.started":"2023-04-16T23:31:34.279629Z","shell.execute_reply":"2023-04-16T23:56:27.531113Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_pred = rf.predict(x_valid)\nprint(metrics.average_precision_score(y_valid, y_pred.clip(0.0,1.0)))","metadata":{"execution":{"iopub.status.busy":"2023-04-16T23:58:11.598947Z","iopub.execute_input":"2023-04-16T23:58:11.599398Z","iopub.status.idle":"2023-04-16T23:59:03.120581Z","shell.execute_reply.started":"2023-04-16T23:58:11.599359Z","shell.execute_reply":"2023-04-16T23:59:03.119630Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from pathlib import Path","metadata":{"execution":{"iopub.status.busy":"2023-04-17T00:16:38.021808Z","iopub.execute_input":"2023-04-17T00:16:38.022252Z","iopub.status.idle":"2023-04-17T00:16:38.027339Z","shell.execute_reply.started":"2023-04-17T00:16:38.022213Z","shell.execute_reply":"2023-04-17T00:16:38.026371Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_files = glob.glob('/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/test/**/**')\nsubmissions = []\nfor file in test_files:\n    test_df = pd.read_csv(file)\n    org_time = test_df[['Time']]\n    id_str = Path(file).stem\n    data_type = 1 if 'defog' in id_str else 0\n    test_df = test_df.assign(Id=id_str, data_type=data_type)\n    test_df = convert_time(test_df, 100) if data_type else convert_time(test_df, 128)\n    test_df = convert_acc(test_df) if data_type else test_df\n    df_test = test_df.merge(metadata_new, how='left', on='Id')\n    results = pd.DataFrame(np.round(rf.predict(df_test[Features]),3), columns=Targets)\n    df_temp = df_test[['Id']]\n    org_time = org_time.reset_index(drop=True)\n    results = results.reset_index(drop=True)\n    sub = pd.concat([org_time, results], axis=1)\n    sub = pd.concat([df_temp, sub], axis=1)\n    sub['Id'] = sub['Id'].astype(str) + '_' + sub['Time'].astype(str)\n    submissions.append(sub[['Id','StartHesitation', 'Turn' , 'Walking']])\n    \nsubmission = pd.concat(submissions)    \nsubmission[['Id','StartHesitation', 'Turn' , 'Walking']].to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2023-04-17T00:16:58.971273Z","iopub.execute_input":"2023-04-17T00:16:58.972174Z","iopub.status.idle":"2023-04-17T00:17:02.606525Z","shell.execute_reply.started":"2023-04-17T00:16:58.972127Z","shell.execute_reply":"2023-04-17T00:17:02.605503Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission","metadata":{"execution":{"iopub.status.busy":"2023-04-17T00:17:42.336072Z","iopub.execute_input":"2023-04-17T00:17:42.336961Z","iopub.status.idle":"2023-04-17T00:17:42.354536Z","shell.execute_reply.started":"2023-04-17T00:17:42.336916Z","shell.execute_reply":"2023-04-17T00:17:42.353173Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"example = pd.read_csv('/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/sample_submission.csv')\nexample","metadata":{"execution":{"iopub.status.busy":"2023-04-17T00:19:01.573442Z","iopub.execute_input":"2023-04-17T00:19:01.573892Z","iopub.status.idle":"2023-04-17T00:19:01.844280Z","shell.execute_reply.started":"2023-04-17T00:19:01.573850Z","shell.execute_reply":"2023-04-17T00:19:01.843340Z"},"trusted":true},"execution_count":null,"outputs":[]}]}