{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"gpu","dataSources":[{"sourceId":59093,"databundleVersionId":7469972,"sourceType":"competition"},{"sourceId":171791159,"sourceType":"kernelVersion"},{"sourceId":30346,"sourceType":"modelInstanceVersion","modelInstanceId":25497},{"sourceId":30347,"sourceType":"modelInstanceVersion","modelInstanceId":25498},{"sourceId":30348,"sourceType":"modelInstanceVersion","modelInstanceId":25499},{"sourceId":30350,"sourceType":"modelInstanceVersion","modelInstanceId":25501},{"sourceId":30351,"sourceType":"modelInstanceVersion","modelInstanceId":25502},{"sourceId":30352,"sourceType":"modelInstanceVersion","modelInstanceId":25503},{"sourceId":30354,"sourceType":"modelInstanceVersion","modelInstanceId":25505},{"sourceId":30357,"sourceType":"modelInstanceVersion","modelInstanceId":25506},{"sourceId":30360,"sourceType":"modelInstanceVersion","modelInstanceId":25508},{"sourceId":30428,"sourceType":"modelInstanceVersion","modelInstanceId":25516}],"dockerImageVersionId":30683,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"%%capture\n!pip install timm transformers audiomentations --no-index --find-links=file:/kaggle/input/hms-pip-wheels3","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:41:02.49335Z","iopub.execute_input":"2024-05-03T15:41:02.493938Z","iopub.status.idle":"2024-05-03T15:41:15.680008Z","shell.execute_reply.started":"2024-05-03T15:41:02.493903Z","shell.execute_reply":"2024-05-03T15:41:15.678758Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import sys\nsys.path.append(f'/kaggle/input/hms-3rd-place-weights/pytorch/src/2/configs/configs')\nsys.path.append(f'/kaggle/input/hms-3rd-place-weights/pytorch/src/2/data/data')\nsys.path.append(f'/kaggle/input/hms-3rd-place-weights/pytorch/src/2/models/models')\nsys.path.append(f'/kaggle/input/hms-3rd-place-weights/pytorch/src/2/configs')","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-05-03T15:41:15.68248Z","iopub.execute_input":"2024-05-03T15:41:15.683192Z","iopub.status.idle":"2024-05-03T15:41:15.68859Z","shell.execute_reply.started":"2024-05-03T15:41:15.683148Z","shell.execute_reply":"2024-05-03T15:41:15.687723Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport scipy as sp\nimport os\nimport json\nimport sys\nimport importlib\nimport multiprocessing as mp\nimport gc\nfrom tqdm import tqdm\nimport glob\nimport torch\nfrom copy import copy\nfrom torch.cuda.amp import GradScaler, autocast\nfrom torch.utils.data import DataLoader\nfrom sklearn.metrics import  mean_squared_error\n\ntorch.backends.cudnn.benchmark = True","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:41:15.693501Z","iopub.execute_input":"2024-05-03T15:41:15.693758Z","iopub.status.idle":"2024-05-03T15:41:21.099472Z","shell.execute_reply.started":"2024-05-03T15:41:15.693734Z","shell.execute_reply":"2024-05-03T15:41:21.098681Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"COMP_FOLDER = '/kaggle/input/hms-harmful-brain-activity-classification/'\n\ntrain_df = pd.read_csv(COMP_FOLDER + 'train.csv')\ntest_df = pd.read_csv(COMP_FOLDER + 'test.csv')\nsample_submission = pd.read_csv(COMP_FOLDER + 'sample_submission.csv')\n\nEEG_FOLDER = '/kaggle/input/hms-harmful-brain-activity-classification/test_eegs/'\n\nPUBLIC_RUN = len(test_df) == 1\nN_CORES = mp.cpu_count()\nMIXED_PRECISION = False\n\nRAM_CHECK = False\nOOF_CHECK = False\n\n\nDEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'\n\nif PUBLIC_RUN is False:\n    RAM_CHECK = False\n    OOF_CHECK = False\n\nif OOF_CHECK is True:\n    train_df = pd.read_csv('/kaggle/input/hms-aws-bucket/train_folded_17k.csv')\n    EEG_FOLDER = '/kaggle/input/hms-harmful-brain-activity-classification/train_eegs/'\n    test_df = train_df[train_df['fold']==0].copy()\n\n\nif RAM_CHECK is True:\n    train_df = pd.read_csv('/kaggle/input/hms-aws-bucket/train_folded_17k.csv')\n    EEG_FOLDER = '/kaggle/input/hms-harmful-brain-activity-classification/train_eegs/'\n    test_df = train_df[train_df['fold']==0].copy()\n    test_df = test_df.head(2640).copy()\n\nprint(train_df.shape)\nprint(test_df.shape)\n\nTARGETS = ['seizure_vote','lpd_vote','gpd_vote','lrda_vote','grda_vote','other_vote']\nif TARGETS[0] not in test_df.columns:\n    test_df[TARGETS] = 1\n    test_df['eeg_label_offset_seconds'] = 0\n    test_df['spectrogram_label_offset_seconds'] = 0","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:41:21.100561Z","iopub.execute_input":"2024-05-03T15:41:21.10097Z","iopub.status.idle":"2024-05-03T15:41:21.472479Z","shell.execute_reply.started":"2024-05-03T15:41:21.100944Z","shell.execute_reply":"2024-05-03T15:41:21.471523Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def get_cfg(CFG):\n    cfg = importlib.import_module('default_config')\n    importlib.reload(cfg)\n    cfg = importlib.import_module(CFG)\n    importlib.reload(cfg)\n    cfg = copy(cfg.cfg)\n    cfg.data_dir = COMP_FOLDER\n    cfg.mixed_precision = MIXED_PRECISION\n    cfg.pretrained = False\n    cfg.pretrained_weights = False\n    cfg.offline_inference = True\n    return cfg\n\ndef get_dl(cfg):\n    ds = importlib.import_module(cfg.dataset)\n    importlib.reload(ds)\n    CustomDataset = ds.CustomDataset\n    batch_to_device = ds.batch_to_device\n    test_ds = CustomDataset(test_df, cfg, cfg.val_aug, mode=\"test\")\n    test_dl = DataLoader(test_ds, shuffle=False, batch_size=cfg.batch_size, collate_fn=ds.val_collate_fn, num_workers=N_CORES, pin_memory=True)\n    return test_dl, batch_to_device\n\ndef get_state_dict(sd_fp):\n    sd = torch.load(sd_fp, map_location=\"cpu\")\n    if \"model\" in sd.keys():\n        sd = sd[\"model\"]\n    sd = {k.replace(\"module.\", \"\"):v for k,v in sd.items()}\n    return sd\n\ndef get_nets(cfg,state_dicts,test_ds):\n    model = importlib.import_module(cfg.model)\n    importlib.reload(model)\n    Net = model.Net\n    nets = []\n    for i,state_dict in enumerate(state_dicts):\n        net = Net(cfg).eval().to(DEVICE)\n        print(\"loading dict\")\n        sd = get_state_dict(state_dict)\n        net.load_state_dict(sd, strict=True)\n        net.return_logits = True\n        nets += [net]\n        del sd\n        gc.collect()\n    return nets","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:41:21.473822Z","iopub.execute_input":"2024-05-03T15:41:21.474099Z","iopub.status.idle":"2024-05-03T15:41:21.484751Z","shell.execute_reply.started":"2024-05-03T15:41:21.474068Z","shell.execute_reply":"2024-05-03T15:41:21.48381Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def generate(name = 'cfg_1', weights_dir = './'):\n    cfg = get_cfg(name)\n    cfg.pretrained = False\n    cfg.data_folder = EEG_FOLDER\n    state_dict_fps = sorted(glob.glob(weights_dir, recursive = True))\n    test_dl, batch_to_device = get_dl(cfg)\n    print('\\n'.join(state_dict_fps))\n    nets = get_nets(cfg,state_dict_fps, test_dl.dataset)\n    preds = []\n    with torch.inference_mode():\n        for batch in tqdm(test_dl):\n            batch = batch_to_device(batch,DEVICE)\n            outs = [net(batch) for net in nets]\n            preds += [torch.stack([out['logits'] for out in outs], dim=0).mean(0).cpu()]\n    preds = torch.cat(preds, dim=0).float()\n    print('preds', preds.shape, ', test_df',test_df.shape)\n    gc.collect()\n    torch.cuda.empty_cache()\n    return preds","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:41:21.486136Z","iopub.execute_input":"2024-05-03T15:41:21.486711Z","iopub.status.idle":"2024-05-03T15:41:21.498958Z","shell.execute_reply.started":"2024-05-03T15:41:21.486677Z","shell.execute_reply":"2024-05-03T15:41:21.498057Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"PREDS = {}","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:41:21.500089Z","iopub.execute_input":"2024-05-03T15:41:21.500343Z","iopub.status.idle":"2024-05-03T15:41:21.510497Z","shell.execute_reply.started":"2024-05-03T15:41:21.50032Z","shell.execute_reply":"2024-05-03T15:41:21.509648Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"PREDS['cfg_1'] = generate(name = 'cfg_1', weights_dir = f'/kaggle/input/hms-3rd-place-weights/pytorch/cfg_1/1/cfg_1/*/*check*')","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:41:21.511755Z","iopub.execute_input":"2024-05-03T15:41:21.512231Z","iopub.status.idle":"2024-05-03T15:41:47.924924Z","shell.execute_reply.started":"2024-05-03T15:41:21.512198Z","shell.execute_reply":"2024-05-03T15:41:47.923868Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"PREDS['cfg_2a'] = generate(name = 'cfg_2a', weights_dir = f'/kaggle/input/hms-3rd-place-weights/pytorch/cfg_2a/1/cfg_2a/*/*check*')","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:41:47.933324Z","iopub.execute_input":"2024-05-03T15:41:47.933633Z","iopub.status.idle":"2024-05-03T15:41:54.712268Z","shell.execute_reply.started":"2024-05-03T15:41:47.933605Z","shell.execute_reply":"2024-05-03T15:41:54.711098Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"PREDS['cfg_2b'] = generate(name = 'cfg_2b', weights_dir = f'/kaggle/input/hms-3rd-place-weights/pytorch/cfg_2b/1/cfg_2b/*/*check*')","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:41:54.715198Z","iopub.execute_input":"2024-05-03T15:41:54.715626Z","iopub.status.idle":"2024-05-03T15:41:59.841844Z","shell.execute_reply.started":"2024-05-03T15:41:54.715599Z","shell.execute_reply":"2024-05-03T15:41:59.84077Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"PREDS['cfg_3'] = generate(name = 'cfg_3', weights_dir = f'/kaggle/input/hms-3rd-place-weights/pytorch/cfg_3/1/cfg_3/*/*check*')","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:41:59.843459Z","iopub.execute_input":"2024-05-03T15:41:59.843758Z","iopub.status.idle":"2024-05-03T15:42:12.51718Z","shell.execute_reply.started":"2024-05-03T15:41:59.84373Z","shell.execute_reply":"2024-05-03T15:42:12.515514Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"PREDS['cfg_4'] = generate(name = 'cfg_4', weights_dir = f'/kaggle/input/hms-3rd-place-weights/pytorch/cfg_4/1/cfg_4/*/*check*')\n","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:42:12.520275Z","iopub.execute_input":"2024-05-03T15:42:12.520724Z","iopub.status.idle":"2024-05-03T15:42:31.188828Z","shell.execute_reply.started":"2024-05-03T15:42:12.520679Z","shell.execute_reply":"2024-05-03T15:42:31.187768Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"PREDS['cfg_5a'] = generate(name = 'cfg_5a', weights_dir = f'/kaggle/input/hms-3rd-place-weights/pytorch/cfg_5a/1/cfg_5a/*/*check*')","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:42:31.190601Z","iopub.execute_input":"2024-05-03T15:42:31.191466Z","iopub.status.idle":"2024-05-03T15:42:49.292435Z","shell.execute_reply.started":"2024-05-03T15:42:31.191424Z","shell.execute_reply":"2024-05-03T15:42:49.291356Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"PREDS['cfg_5b'] = generate(name = 'cfg_5b', weights_dir = f'/kaggle/input/hms-3rd-place-weights/pytorch/cfg_5b/1/cfg_5b/*/*check*')","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:42:49.294334Z","iopub.execute_input":"2024-05-03T15:42:49.294726Z","iopub.status.idle":"2024-05-03T15:43:05.886747Z","shell.execute_reply.started":"2024-05-03T15:42:49.294688Z","shell.execute_reply":"2024-05-03T15:43:05.885649Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"PREDS['cfg_5c'] = generate(name = 'cfg_5c', weights_dir = f'/kaggle/input/hms-3rd-place-weights/pytorch/cfg_5c/1/cfg_5c/*/*check*')","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:05.889375Z","iopub.execute_input":"2024-05-03T15:43:05.889696Z","iopub.status.idle":"2024-05-03T15:43:22.128859Z","shell.execute_reply.started":"2024-05-03T15:43:05.889669Z","shell.execute_reply":"2024-05-03T15:43:22.127706Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"PREDS['cfg_5d'] = generate(name = 'cfg_5d', weights_dir = f'/kaggle/input/hms-3rd-place-weights/pytorch/cfg_5d/1/cfg_5d/*/*check*')","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:22.132131Z","iopub.execute_input":"2024-05-03T15:43:22.133101Z","iopub.status.idle":"2024-05-03T15:43:40.590163Z","shell.execute_reply.started":"2024-05-03T15:43:22.133068Z","shell.execute_reply":"2024-05-03T15:43:40.589077Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"CLASS_BIAS = [ 0.012535,  0.03458 ,  0.01761 ,  0.05957 , -0.02608 , -0.0982  ]","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:40.593079Z","iopub.execute_input":"2024-05-03T15:43:40.593411Z","iopub.status.idle":"2024-05-03T15:43:40.598354Z","shell.execute_reply.started":"2024-05-03T15:43:40.593383Z","shell.execute_reply":"2024-05-03T15:43:40.59743Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"WEIGHTS = {'cfg_1': 0.12932,\n 'cfg_2a': 0.14089,\n 'cfg_2b': 0.12269,\n 'cfg_3': 0.1174,\n 'cfg_4': 0.10538,\n 'cfg_5a': 0.0987,\n 'cfg_5b': 0.15285,\n 'cfg_5c': 0.10973,\n 'cfg_5d': 0.09444}","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:40.599708Z","iopub.execute_input":"2024-05-03T15:43:40.600003Z","iopub.status.idle":"2024-05-03T15:43:40.614065Z","shell.execute_reply.started":"2024-05-03T15:43:40.599978Z","shell.execute_reply":"2024-05-03T15:43:40.613231Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"assert sorted(PREDS.keys()) == sorted(WEIGHTS.keys())\n","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:40.615153Z","iopub.execute_input":"2024-05-03T15:43:40.615961Z","iopub.status.idle":"2024-05-03T15:43:40.624561Z","shell.execute_reply.started":"2024-05-03T15:43:40.615927Z","shell.execute_reply":"2024-05-03T15:43:40.623812Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for k,p in PREDS.items():\n    print(k)\n    print(np.around(p[:3].softmax(1).numpy(), decimals=3))\n","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:40.625617Z","iopub.execute_input":"2024-05-03T15:43:40.625929Z","iopub.status.idle":"2024-05-03T15:43:40.63836Z","shell.execute_reply.started":"2024-05-03T15:43:40.625897Z","shell.execute_reply":"2024-05-03T15:43:40.637314Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"total_weights = sum(list(WEIGHTS.values()))\ntotal_weights","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:40.63975Z","iopub.execute_input":"2024-05-03T15:43:40.640062Z","iopub.status.idle":"2024-05-03T15:43:40.646659Z","shell.execute_reply.started":"2024-05-03T15:43:40.64004Z","shell.execute_reply":"2024-05-03T15:43:40.645735Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"WEIGHTS = {k:v/sum(list(WEIGHTS.values())) for k,v in WEIGHTS.items()}\nsum(list(WEIGHTS.values()))","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:40.647734Z","iopub.execute_input":"2024-05-03T15:43:40.648049Z","iopub.status.idle":"2024-05-03T15:43:40.658675Z","shell.execute_reply.started":"2024-05-03T15:43:40.648019Z","shell.execute_reply":"2024-05-03T15:43:40.657833Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for k,v in WEIGHTS.items():\n    print(f'{v:0.3f} {k}')","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:40.659722Z","iopub.execute_input":"2024-05-03T15:43:40.660004Z","iopub.status.idle":"2024-05-03T15:43:40.667084Z","shell.execute_reply.started":"2024-05-03T15:43:40.659982Z","shell.execute_reply":"2024-05-03T15:43:40.66613Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"preds = torch.stack([(v * WEIGHTS[k]) for k,v in PREDS.items()]).sum(0)\n","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:40.668146Z","iopub.execute_input":"2024-05-03T15:43:40.668425Z","iopub.status.idle":"2024-05-03T15:43:40.677518Z","shell.execute_reply.started":"2024-05-03T15:43:40.668402Z","shell.execute_reply":"2024-05-03T15:43:40.676747Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(np.around(preds[:3].numpy(), decimals=3))\n","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:40.678542Z","iopub.execute_input":"2024-05-03T15:43:40.678777Z","iopub.status.idle":"2024-05-03T15:43:40.685243Z","shell.execute_reply.started":"2024-05-03T15:43:40.678756Z","shell.execute_reply":"2024-05-03T15:43:40.684316Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"postproc = torch.tensor(CLASS_BIAS).unsqueeze(0)\n","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:40.686517Z","iopub.execute_input":"2024-05-03T15:43:40.686828Z","iopub.status.idle":"2024-05-03T15:43:40.694301Z","shell.execute_reply.started":"2024-05-03T15:43:40.68678Z","shell.execute_reply":"2024-05-03T15:43:40.693389Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"preds = preds + postproc\n","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:40.699927Z","iopub.execute_input":"2024-05-03T15:43:40.700177Z","iopub.status.idle":"2024-05-03T15:43:40.704514Z","shell.execute_reply.started":"2024-05-03T15:43:40.700156Z","shell.execute_reply":"2024-05-03T15:43:40.703603Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(np.around(preds[:3].numpy(), decimals=3))\n","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:40.705771Z","iopub.execute_input":"2024-05-03T15:43:40.706057Z","iopub.status.idle":"2024-05-03T15:43:40.714256Z","shell.execute_reply.started":"2024-05-03T15:43:40.706035Z","shell.execute_reply":"2024-05-03T15:43:40.713441Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"preds = preds.softmax(1).numpy().copy()\n","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:40.715308Z","iopub.execute_input":"2024-05-03T15:43:40.716155Z","iopub.status.idle":"2024-05-03T15:43:40.728493Z","shell.execute_reply.started":"2024-05-03T15:43:40.716129Z","shell.execute_reply":"2024-05-03T15:43:40.727683Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"preds = preds / preds.sum(1)[:,None]\n","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:40.729527Z","iopub.execute_input":"2024-05-03T15:43:40.72987Z","iopub.status.idle":"2024-05-03T15:43:40.737451Z","shell.execute_reply.started":"2024-05-03T15:43:40.72984Z","shell.execute_reply":"2024-05-03T15:43:40.736664Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(np.around(preds[:3], decimals=3))\n","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:40.738454Z","iopub.execute_input":"2024-05-03T15:43:40.738971Z","iopub.status.idle":"2024-05-03T15:43:40.747076Z","shell.execute_reply.started":"2024-05-03T15:43:40.738937Z","shell.execute_reply":"2024-05-03T15:43:40.746111Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub = pd.DataFrame({'eeg_id': test_df.eeg_id.values})\nsub[TARGETS] = preds\nsub.to_csv('submission.csv',index=False)\nprint('Submission shape',sub.shape)\nsub.head()","metadata":{"execution":{"iopub.status.busy":"2024-05-03T15:43:40.748186Z","iopub.execute_input":"2024-05-03T15:43:40.74842Z","iopub.status.idle":"2024-05-03T15:43:40.773018Z","shell.execute_reply.started":"2024-05-03T15:43:40.748399Z","shell.execute_reply":"2024-05-03T15:43:40.772168Z"},"trusted":true},"execution_count":null,"outputs":[]}]}