{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":59093,"databundleVersionId":7469972,"sourceType":"competition"}],"dockerImageVersionId":30635,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport pathlib\ntrain_eegs = pathlib.Path(\"/kaggle/input/hms-harmful-brain-activity-classification/train_eegs\")\ntrain_specs = pathlib.Path(\"/kaggle/input/hms-harmful-brain-activity-classification/train_spectrograms\")","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-01-20T15:08:53.022688Z","iopub.execute_input":"2024-01-20T15:08:53.023163Z","iopub.status.idle":"2024-01-20T15:08:53.029328Z","shell.execute_reply.started":"2024-01-20T15:08:53.023127Z","shell.execute_reply":"2024-01-20T15:08:53.028084Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## For all of your normalization needs\nContains means/variance for columns for eeg/spectrograms in a numpy array.\n\nI've never used dask before so thought I might as well try, it probably isn't the fastest way of doing this, was pretty easy and simple to do though.","metadata":{}},{"cell_type":"code","source":"import sys\nnp.set_printoptions(threshold=sys.maxsize)","metadata":{"execution":{"iopub.status.busy":"2024-01-20T15:08:53.031551Z","iopub.execute_input":"2024-01-20T15:08:53.031977Z","iopub.status.idle":"2024-01-20T15:08:53.040664Z","shell.execute_reply.started":"2024-01-20T15:08:53.031943Z","shell.execute_reply":"2024-01-20T15:08:53.039373Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## EEGS","metadata":{}},{"cell_type":"code","source":"import dask.dataframe as dd\ndf = dd.read_parquet(train_eegs/\"*.parquet\")","metadata":{"execution":{"iopub.status.busy":"2024-01-20T15:08:53.042195Z","iopub.execute_input":"2024-01-20T15:08:53.042532Z","iopub.status.idle":"2024-01-20T15:08:55.698799Z","shell.execute_reply.started":"2024-01-20T15:08:53.042503Z","shell.execute_reply":"2024-01-20T15:08:55.697527Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.mean(axis=0, skipna=True).compute().to_numpy()","metadata":{"execution":{"iopub.status.busy":"2024-01-20T15:08:55.701469Z","iopub.execute_input":"2024-01-20T15:08:55.702092Z","iopub.status.idle":"2024-01-20T15:12:18.803931Z","shell.execute_reply.started":"2024-01-20T15:08:55.702059Z","shell.execute_reply":"2024-01-20T15:12:18.802779Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.var(axis=0, skipna=True).compute().to_numpy()","metadata":{"execution":{"iopub.status.busy":"2024-01-20T15:12:18.806207Z","iopub.execute_input":"2024-01-20T15:12:18.806548Z","iopub.status.idle":"2024-01-20T15:15:24.137146Z","shell.execute_reply.started":"2024-01-20T15:12:18.806519Z","shell.execute_reply":"2024-01-20T15:15:24.135900Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## SPECS","metadata":{}},{"cell_type":"code","source":"df_spec = dd.read_parquet(train_specs/\"*.parquet\")","metadata":{"execution":{"iopub.status.busy":"2024-01-20T15:15:24.138615Z","iopub.execute_input":"2024-01-20T15:15:24.138952Z","iopub.status.idle":"2024-01-20T15:15:26.355012Z","shell.execute_reply.started":"2024-01-20T15:15:24.138924Z","shell.execute_reply":"2024-01-20T15:15:26.353580Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_spec.mean(axis=0, skipna=True).compute().to_numpy()","metadata":{"execution":{"iopub.status.busy":"2024-01-20T15:15:26.356695Z","iopub.execute_input":"2024-01-20T15:15:26.357189Z","iopub.status.idle":"2024-01-20T15:22:29.528866Z","shell.execute_reply.started":"2024-01-20T15:15:26.357144Z","shell.execute_reply":"2024-01-20T15:22:29.527331Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_spec.var(axis=0, skipna=True).compute().to_numpy()","metadata":{"execution":{"iopub.status.busy":"2024-01-20T15:22:29.530242Z","iopub.execute_input":"2024-01-20T15:22:29.530590Z","iopub.status.idle":"2024-01-20T15:28:20.687321Z","shell.execute_reply.started":"2024-01-20T15:22:29.530552Z","shell.execute_reply":"2024-01-20T15:28:20.686136Z"},"trusted":true},"execution_count":null,"outputs":[]}]}