{"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 numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport os\nfrom tqdm import tqdm\nimport glob","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-03-12T07:33:57.847157Z","iopub.execute_input":"2023-03-12T07:33:57.849126Z","iopub.status.idle":"2023-03-12T07:33:57.892391Z","shell.execute_reply.started":"2023-03-12T07:33:57.849046Z","shell.execute_reply":"2023-03-12T07:33:57.890588Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"base_dir = '/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/'\n","metadata":{"execution":{"iopub.status.busy":"2023-03-12T07:33:57.990329Z","iopub.execute_input":"2023-03-12T07:33:57.990823Z","iopub.status.idle":"2023-03-12T07:33:57.997889Z","shell.execute_reply.started":"2023-03-12T07:33:57.990778Z","shell.execute_reply":"2023-03-12T07:33:57.996402Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def reader(f):\n    df = pd.read_csv(f)\n    df['Id'] = f.split('/')[-1].split('.')[0]\n    return df\n\ndef read_train_sub(type='defog'):\n    print(f\"raeding {type}\\n\")\n    train_files = glob.glob(base_dir+f'train/{type}/**') #Time \tAccV \tAccML \tAccAP \tStartHesitation \tTurn \tWalking \tValid \tTask\n    train = pd.concat([reader(f) for f in tqdm(train_files)])\n    print(train.shape)\n    train.to_parquet(f'train_{type}.parquet.gzip',compression='gzip')\n    del train,train_files","metadata":{"execution":{"iopub.status.busy":"2023-03-12T07:33:58.144433Z","iopub.execute_input":"2023-03-12T07:33:58.144830Z","iopub.status.idle":"2023-03-12T07:33:58.154401Z","shell.execute_reply.started":"2023-03-12T07:33:58.144801Z","shell.execute_reply":"2023-03-12T07:33:58.152568Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"read_train_sub(type='defog')","metadata":{"execution":{"iopub.status.busy":"2023-03-12T07:33:58.265426Z","iopub.execute_input":"2023-03-12T07:33:58.266505Z","iopub.status.idle":"2023-03-12T07:35:05.961584Z","shell.execute_reply.started":"2023-03-12T07:33:58.266456Z","shell.execute_reply":"2023-03-12T07:35:05.959628Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"read_train_sub(type='tdcsfog')","metadata":{"execution":{"iopub.status.busy":"2023-03-12T07:35:05.964262Z","iopub.execute_input":"2023-03-12T07:35:05.964701Z","iopub.status.idle":"2023-03-12T07:35:37.039967Z","shell.execute_reply.started":"2023-03-12T07:35:05.964663Z","shell.execute_reply":"2023-03-12T07:35:37.038049Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"read_train_sub(type='notype')","metadata":{"execution":{"iopub.status.busy":"2023-03-12T07:35:37.041686Z","iopub.execute_input":"2023-03-12T07:35:37.042167Z","iopub.status.idle":"2023-03-12T07:36:28.296605Z","shell.execute_reply.started":"2023-03-12T07:35:37.042120Z","shell.execute_reply":"2023-03-12T07:36:28.294109Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## laod data","metadata":{}},{"cell_type":"code","source":"train_tdcsfog=pd.read_parquet('/kaggle/working/train_tdcsfog.parquet.gzip')\ntrain_tdcsfog.shape","metadata":{"execution":{"iopub.status.busy":"2023-03-12T07:48:37.390953Z","iopub.execute_input":"2023-03-12T07:48:37.392581Z","iopub.status.idle":"2023-03-12T07:48:38.399825Z","shell.execute_reply.started":"2023-03-12T07:48:37.392510Z","shell.execute_reply":"2023-03-12T07:48:38.398723Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_tdcsfog[train_tdcsfog['Walking']==1]","metadata":{"execution":{"iopub.status.busy":"2023-03-12T07:49:21.660351Z","iopub.execute_input":"2023-03-12T07:49:21.660807Z","iopub.status.idle":"2023-03-12T07:49:21.694965Z","shell.execute_reply.started":"2023-03-12T07:49:21.660766Z","shell.execute_reply":"2023-03-12T07:49:21.692991Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_tdcsfog[train_tdcsfog['Turn']==1]","metadata":{"execution":{"iopub.status.busy":"2023-03-12T07:49:56.672979Z","iopub.execute_input":"2023-03-12T07:49:56.673433Z","iopub.status.idle":"2023-03-12T07:49:56.755161Z","shell.execute_reply.started":"2023-03-12T07:49:56.673393Z","shell.execute_reply":"2023-03-12T07:49:56.753809Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_defog=pd.read_parquet('/kaggle/working/train_defog.parquet.gzip')\ntrain_defog.shape","metadata":{"execution":{"iopub.status.busy":"2023-03-12T07:52:06.858600Z","iopub.execute_input":"2023-03-12T07:52:06.859027Z","iopub.status.idle":"2023-03-12T07:52:08.454799Z","shell.execute_reply.started":"2023-03-12T07:52:06.858991Z","shell.execute_reply":"2023-03-12T07:52:08.453989Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_defog.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-12T07:52:17.337567Z","iopub.execute_input":"2023-03-12T07:52:17.338193Z","iopub.status.idle":"2023-03-12T07:52:17.354740Z","shell.execute_reply.started":"2023-03-12T07:52:17.338155Z","shell.execute_reply":"2023-03-12T07:52:17.353271Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_notype=pd.read_parquet('/kaggle/working/train_notype.parquet.gzip')\ntrain_notype.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-12T07:52:42.202524Z","iopub.execute_input":"2023-03-12T07:52:42.203052Z","iopub.status.idle":"2023-03-12T07:52:43.418008Z","shell.execute_reply.started":"2023-03-12T07:52:42.203011Z","shell.execute_reply":"2023-03-12T07:52:43.416066Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}