{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.10","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"sourceId":4477,"databundleVersionId":44220,"sourceType":"competition"}],"dockerImageVersionId":30512,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np\nfrom zipfile import ZipFile\nimport matplotlib.pyplot as plt\nimport os\nimport pandas as pd\nimport torch\nfrom torch.utils.data import DataLoader, Dataset\nimport torch.nn as nn\nimport torch.optim as optim\nimport random\nimport torch.nn.functional as F\nimport argparse\nfrom sklearn import metrics\nfrom tqdm.notebook import tqdm\nimport gc\nimport shutil","metadata":{"_uuid":"f477f8ef-b84d-4f2e-b178-fb13d2fed5a5","_cell_guid":"678309d5-d0f7-42af-8145-6671cad61f51","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2024-02-25T08:16:19.835050Z","iopub.status.idle":"2024-02-25T08:16:19.835365Z","shell.execute_reply.started":"2024-02-25T08:16:19.835203Z","shell.execute_reply":"2024-02-25T08:16:19.835218Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\nFILE_PATH = '../input/grasp-and-lift-eeg-detection'\nlist_dir = os.listdir(FILE_PATH)\n\nfor zipfile in list_dir:\n    with ZipFile(os.path.join(FILE_PATH, zipfile), 'r') as z:\n        z.extractall()","metadata":{"execution":{"iopub.status.busy":"2024-02-25T07:48:15.916180Z","iopub.execute_input":"2024-02-25T07:48:15.916644Z","iopub.status.idle":"2024-02-25T07:48:41.947166Z","shell.execute_reply.started":"2024-02-25T07:48:15.916596Z","shell.execute_reply":"2024-02-25T07:48:41.946207Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels = ['HandStart', 'FirstDigitTouch', 'BothStartLoadPhase', 'LiftOff',\n       'Replace', 'BothReleased']\n","metadata":{"execution":{"iopub.status.busy":"2024-02-25T07:48:41.948256Z","iopub.execute_input":"2024-02-25T07:48:41.948531Z","iopub.status.idle":"2024-02-25T07:48:41.953902Z","shell.execute_reply.started":"2024-02-25T07:48:41.948507Z","shell.execute_reply":"2024-02-25T07:48:41.952989Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"torch.manual_seed(2021)\nnp.random.seed(2021)\ndevice = torch.device('cuda' if torch.cuda.is_available() else 'cpu')\n\nparser = argparse.ArgumentParser()\nparser.add_argument(\"--n_epochs\", type=int, default=1, help=\"number of epochs of training\")\nparser.add_argument(\"--batch_size\", type=int, default=1024, help=\"size of the batches\")\nparser.add_argument(\"--lr\", type=float, default=0.002, help=\"adam's learning rate\")\nparser.add_argument(\"--b1\", type=float, default=0.5, help=\"adam: decay of first order momentum of gradient\")\nparser.add_argument(\"--b2\", type=float, default=0.99, help=\"adam: decay of first order momentum of gradient\")\nparser.add_argument(\"--n_cpu\", type=int, default=1, help=\"number of cpu threads to use during batch generation\")\nparser.add_argument(\"--in_len\", type=int, default=2**10, help=\"length of the input fed to neural net\")\nparser.add_argument(\"--in_channels\", type=int, default=32, help=\"number of signal channels\")\nparser.add_argument(\"--out_channels\", type=int, default=6, help=\"number of classes\")\nparser.add_argument(\"--chunk\", type=int, default=1000, help=\"length of splited chunks\")\nopt, unknown = parser.parse_known_args()\nprint(device)","metadata":{"execution":{"iopub.status.busy":"2024-02-25T07:48:42.080052Z","iopub.execute_input":"2024-02-25T07:48:42.080324Z","iopub.status.idle":"2024-02-25T07:48:42.091317Z","shell.execute_reply.started":"2024-02-25T07:48:42.080301Z","shell.execute_reply":"2024-02-25T07:48:42.090452Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"if device.type == 'cuda':\n    print(torch.cuda.get_device_name(0))\n    print('Memory Usage:')\n    print('Allocated:', round(torch.cuda.memory_allocated(0)/1024**3,1), 'GB')\n    print('Cached:   ', round(torch.cuda.memory_reserved(0)/1024**3,1), 'GB')","metadata":{"execution":{"iopub.status.busy":"2024-02-25T07:48:42.092429Z","iopub.execute_input":"2024-02-25T07:48:42.093399Z","iopub.status.idle":"2024-02-25T07:48:42.179267Z","shell.execute_reply.started":"2024-02-25T07:48:42.093374Z","shell.execute_reply":"2024-02-25T07:48:42.178376Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\ndef read_csv(data, events):\n    x = pd.read_csv(data)\n    y = pd.read_csv(events)\n    id = '_'.join(x.iloc[0, 0].split('_')[:-1])\n    x = x.iloc[:,1:].values\n    y = y.iloc[:,1:].values\n    return x, y\n    \n\ntrainset = []\ngt = []\nfor filename in tqdm(os.listdir('./train')):\n    if 'data' in filename:\n        data_file_name = os.path.join('./train', filename)\n        id = filename.split('.')[0]\n        events_file_name = os.path.join('./train', '_'.join(id.split('_')[:-1]) + '_events.csv')\n        x, y = read_csv(data_file_name, events_file_name)\n        trainset.append(x.T.astype(np.float32))\n        gt.append(y.T.astype(np.float32))","metadata":{"execution":{"iopub.status.busy":"2024-02-25T07:48:42.180528Z","iopub.execute_input":"2024-02-25T07:48:42.181154Z","iopub.status.idle":"2024-02-25T07:50:02.170078Z","shell.execute_reply.started":"2024-02-25T07:48:42.181118Z","shell.execute_reply":"2024-02-25T07:50:02.169193Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"valid_dataset = trainset[-2:]\nvalid_gt = gt[-2:]\ntrainset = trainset[:-2]\ngt = gt[:-2]","metadata":{"execution":{"iopub.status.busy":"2024-02-20T02:12:26.977439Z","iopub.execute_input":"2024-02-20T02:12:26.977849Z","iopub.status.idle":"2024-02-20T02:12:26.983256Z","shell.execute_reply.started":"2024-02-20T02:12:26.977819Z","shell.execute_reply":"2024-02-20T02:12:26.982088Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data = np.concatenate(trainset, axis=1) # Concatenate trainset list into a single numpy array\n\ndata_f=pd.DataFrame(data)\nprint(data_f.columns)\n\n# Calculate mean and std along the column axis (axis=1)\nmean = np.mean(data, axis=1)\nstd = np.std(data, axis=1)\n\n# Reshape mean and std arrays to match the shape of the data\nm = np.reshape(mean, (mean.shape[0], 1))\ns = np.reshape(std, (std.shape[0], 1))","metadata":{"execution":{"iopub.status.busy":"2024-02-25T07:50:05.476742Z","iopub.execute_input":"2024-02-25T07:50:05.477028Z","iopub.status.idle":"2024-02-25T07:50:07.761876Z","shell.execute_reply.started":"2024-02-25T07:50:05.477005Z","shell.execute_reply":"2024-02-25T07:50:07.761091Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(data.T[0])","metadata":{"execution":{"iopub.status.busy":"2024-02-25T09:16:21.342825Z","iopub.execute_input":"2024-02-25T09:16:21.343639Z","iopub.status.idle":"2024-02-25T09:16:21.348993Z","shell.execute_reply.started":"2024-02-25T09:16:21.343608Z","shell.execute_reply":"2024-02-25T09:16:21.347988Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def resample_data(gt, chunk_size=opt.chunk):\n    \"\"\"\n    split long signals to smaller chunks, discard no-events chunks  \n    \"\"\"\n    total_discard_chunks = 0\n    mean_val = []\n    threshold = 0.01\n    index = []\n    \n    for i in range(len(gt)):\n        for j in range(0, gt[i].shape[1], chunk_size):\n            mean_val.append(np.mean(gt[i][:, j:min(gt[i].shape[1],j+chunk_size)]))\n            if mean_val[-1] < threshold:  # discard chunks with low events time\n                total_discard_chunks += 1\n            else:\n                index.extend([(i, k) for k in range(j, min(gt[i].shape[1],j+chunk_size))])\n\n    plt.plot([0, len(mean_val)], [threshold, threshold], color='r')\n    plt.scatter(range(len(mean_val)), mean_val, s=1)\n    plt.show()\n    print('Total number of chunks discarded: {} chunks'.format(total_discard_chunks))\n    print('{}% data'.format(total_discard_chunks/len(mean_val)))\n    del mean_val\n    gc.collect()\n    return index","metadata":{"execution":{"iopub.status.busy":"2024-02-25T09:17:20.144709Z","iopub.execute_input":"2024-02-25T09:17:20.145450Z","iopub.status.idle":"2024-02-25T09:17:20.154626Z","shell.execute_reply.started":"2024-02-25T09:17:20.145419Z","shell.execute_reply":"2024-02-25T09:17:20.153711Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\nclass EEGSignalDataset(Dataset):\n    def __init__(self, data, gt, m=m, s=s, soft_label=True, train=True):\n        self.data = data\n        self.gt = gt\n        self.train = train\n        self.soft_label = soft_label\n        self.eps = 1e-7\n        if train:\n            self.index = resample_data(gt)\n        else:\n            self.index = [(i, j) for i in range(len(data)) for j in range(data[i].shape[1])]\n        for dt in self.data:\n            dt -= m\n            dt /= s+self.eps\n    \n    def __getitem__(self, i):\n        i, j = self.index[i]\n        raw_data, label = self.data[i][:,max(0, j-opt.in_len+1):j+1], \\\n                self.gt[i][:,j]\n        \n        pad = opt.in_len - raw_data.shape[1]\n        if pad:\n            raw_data = np.pad(raw_data, ((0,0),(pad,0)), 'constant',constant_values=0)\n\n        raw_data, label = torch.from_numpy(raw_data.astype(np.float32)),\\\n                            torch.from_numpy(label.astype(np.float32))\n        if self.soft_label:\n            label[label < .02] = .02\n        return raw_data, label\n            \n    \n    def __len__(self):\n        return len(self.index)\n    \ndataset = EEGSignalDataset(trainset, gt)\nprint(type(dataset))\ndataloader = DataLoader(dataset, batch_size = opt.batch_size,\\\n                                       num_workers = opt.n_cpu, shuffle=True)\nprint(len(dataset))","metadata":{"execution":{"iopub.status.busy":"2024-02-25T07:50:07.780907Z","iopub.execute_input":"2024-02-25T07:50:07.781500Z","iopub.status.idle":"2024-02-25T07:50:10.937411Z","shell.execute_reply.started":"2024-02-25T07:50:07.781466Z","shell.execute_reply":"2024-02-25T07:50:10.936475Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class NNet(nn.Module):\n    def __init__(self, in_channels=opt.in_channels, out_channels=opt.out_channels):\n        super(NNet, self).__init__()\n        self.hidden = 32\n        self.net = nn.Sequential(\n            nn.Conv1d(opt.in_channels, opt.in_channels, 5, padding=2),\n            nn.Conv1d(self.hidden, self.hidden, 16, stride=16),\n            nn.LeakyReLU(0.1),\n            nn.Conv1d(self.hidden, self.hidden, 7, padding=3),\n        )\n        for i in range(6):\n            self.net.add_module('conv{}'.format(i), \\\n                                self.__block(self.hidden, self.hidden))\n        self.net.add_module('final', nn.Sequential(\n            nn.Conv1d(self.hidden, out_channels, 1),\n            nn.Sigmoid()\n        ))\n        \n    def __block(self, inchannels, outchannels):\n        return nn.Sequential(\n            nn.MaxPool1d(2, 2),\n            nn.Dropout(p=0.1, inplace=True),\n            nn.Conv1d(inchannels, outchannels, 5, padding=2),\n            nn.LeakyReLU(0.1),\n            nn.Conv1d(outchannels, outchannels, 5, padding=2),\n            nn.LeakyReLU(0.1),\n        )\n    \n    def forward(self, x):\n        return self.net(x)","metadata":{"execution":{"iopub.status.busy":"2024-02-25T07:50:10.938762Z","iopub.execute_input":"2024-02-25T07:50:10.939424Z","iopub.status.idle":"2024-02-25T07:50:10.949841Z","shell.execute_reply.started":"2024-02-25T07:50:10.939388Z","shell.execute_reply":"2024-02-25T07:50:10.948973Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nnet = NNet()\nnnet.to(device)\nloss_fnc = nn.BCELoss()\nadam = optim.Adam(nnet.parameters(), lr=opt.lr, betas=(opt.b1, opt.b2))\nloss_his, train_loss = [], []\nnnet.train()\nfor epoch in range(opt.n_epochs):\n    p_bar = tqdm(dataloader)\n    for i, (x, y) in enumerate(p_bar):\n        x, y = x.to(device), y.to(device)\n        pred = nnet(x)\n        loss = loss_fnc(pred.squeeze(dim=-1), y)\n        adam.zero_grad()\n        loss.backward()\n        adam.step()\n        train_loss.append(loss.item())\n        p_bar.set_description('[Loss: {}]'.format(train_loss[-1])) \n        if i % 50 == 0:\n            loss_his.append(np.mean(train_loss))\n            train_loss.clear()\n    print('[Epoch {}/{}] [Loss: {}]'.format(epoch+1, opt.n_epochs, loss_his[-1]))\n    \ntorch.save(nnet.state_dict(), 'model.pt')\n","metadata":{"execution":{"iopub.status.busy":"2024-02-25T07:50:10.950925Z","iopub.execute_input":"2024-02-25T07:50:10.951268Z","iopub.status.idle":"2024-02-25T08:16:19.345057Z","shell.execute_reply.started":"2024-02-25T07:50:10.951245Z","shell.execute_reply":"2024-02-25T08:16:19.343887Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.plot(range(len(loss_his)), loss_his, label='loss')\nplt.legend()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-02-25T08:17:23.478505Z","iopub.execute_input":"2024-02-25T08:17:23.478965Z","iopub.status.idle":"2024-02-25T08:17:23.741319Z","shell.execute_reply.started":"2024-02-25T08:17:23.478923Z","shell.execute_reply":"2024-02-25T08:17:23.740252Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"testset = EEGSignalDataset(valid_dataset, valid_gt, train=False, soft_label=False) \ntestloader = DataLoader(testset, batch_size = opt.batch_size,\\\n                                       num_workers = opt.n_cpu, shuffle=False)\nnnet.eval()\ny_pred = []\nwith torch.no_grad():\n    for x, _ in tqdm(testloader):\n        x = x.to(device)\n        pred = nnet(x).detach().cpu().numpy()\n        y_pred.append(pred)","metadata":{"execution":{"iopub.status.busy":"2024-02-25T08:17:26.693103Z","iopub.execute_input":"2024-02-25T08:17:26.693452Z","iopub.status.idle":"2024-02-25T08:18:18.660697Z","shell.execute_reply.started":"2024-02-25T08:17:26.693425Z","shell.execute_reply":"2024-02-25T08:18:18.659631Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def plot_roc(y_true, y_pred):\n    fig, axs = plt.subplots(3, 2, figsize=(15,13))\n    for i, label in enumerate(labels):\n        fpr, tpr, _ = metrics.roc_curve(y_true[i], y_pred[i])\n        ax = axs[i//2, i%2]\n        ax.plot(fpr, tpr)\n        ax.set_title(label+\" ROC\")\n        ax.plot([0, 1], [0, 1], 'k--')\n\n    plt.show()\n    \ny_pred = np.concatenate(y_pred, axis=0).squeeze(axis=-1)\nvalid_gt = np.concatenate(valid_gt, axis=1)\nplot_roc(valid_gt, y_pred.T)\nprint('auc roc: ', metrics.roc_auc_score(valid_gt.T, y_pred))","metadata":{"execution":{"iopub.status.busy":"2024-02-25T08:22:30.651799Z","iopub.execute_input":"2024-02-25T08:22:30.652354Z","iopub.status.idle":"2024-02-25T08:22:32.902924Z","shell.execute_reply.started":"2024-02-25T08:22:30.652319Z","shell.execute_reply":"2024-02-25T08:22:32.901974Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"del y_pred\ndel testset\ndel testloader\ndel valid_dataset\ndel valid_gt\ngc.collect()","metadata":{"execution":{"iopub.status.busy":"2024-02-25T08:22:37.955546Z","iopub.execute_input":"2024-02-25T08:22:37.955889Z","iopub.status.idle":"2024-02-25T08:22:38.337745Z","shell.execute_reply.started":"2024-02-25T08:22:37.955863Z","shell.execute_reply":"2024-02-25T08:22:38.336989Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_pred = []\ny_true = []\nwith torch.no_grad():\n    for x, y in tqdm(dataloader):\n        x = x.to(device)\n        pred = nnet(x).squeeze(dim=-1).detach().cpu().numpy()\n        y_pred.append(pred)\n        y_true.append(y)","metadata":{"execution":{"iopub.status.busy":"2024-02-25T08:22:41.052802Z","iopub.execute_input":"2024-02-25T08:22:41.053182Z","iopub.status.idle":"2024-02-25T08:55:09.344031Z","shell.execute_reply.started":"2024-02-25T08:22:41.053153Z","shell.execute_reply":"2024-02-25T08:55:09.342848Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"i = 1231\nwith torch.no_grad():\n    input = dataset[i][0].unsqueeze(dim=0)\n    print(nnet(input.to(device)))\n    print(dataset[i][1])","metadata":{"execution":{"iopub.status.busy":"2024-02-25T08:16:19.821054Z","iopub.status.idle":"2024-02-25T08:16:19.821374Z","shell.execute_reply.started":"2024-02-25T08:16:19.821208Z","shell.execute_reply":"2024-02-25T08:16:19.821231Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"del y_pred\ndel y_true\ndel dataset\ndel dataloader\ndel trainset\ndel gt\ngc.collect()","metadata":{"execution":{"iopub.status.busy":"2024-02-25T08:16:19.823049Z","iopub.status.idle":"2024-02-25T08:16:19.823363Z","shell.execute_reply.started":"2024-02-25T08:16:19.823206Z","shell.execute_reply":"2024-02-25T08:16:19.823222Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class EEGSignalTestset(Dataset):\n    def __init__(self, data, m, s):\n        self.data = data\n        self.eps = 1e-7\n        self.data -= m\n        self.data /= s+self.eps\n    \n    def __getitem__(self, i):\n\n        raw_data = self.data[:,max(0, i-opt.in_len+1):i+1]\n        \n        pad = opt.in_len - raw_data.shape[1]\n        if pad:\n            raw_data = np.pad(raw_data, ((0,0),(pad,0)), 'constant',constant_values=0)\n\n        raw_data = torch.from_numpy(raw_data.astype(np.float32))\n        return raw_data\n            \n    \n    def __len__(self):\n        return self.data.shape[1]\n","metadata":{"execution":{"iopub.status.busy":"2023-11-29T05:00:20.436721Z","iopub.execute_input":"2023-11-29T05:00:20.437451Z","iopub.status.idle":"2023-11-29T05:00:20.444643Z","shell.execute_reply.started":"2023-11-29T05:00:20.437420Z","shell.execute_reply":"2023-11-29T05:00:20.443675Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\ntestset = []\ntrial_len = {}\nFNAME = \"./test/subj{}_series{}_{}.csv\"\n\nfor subj in range(1,13):\n    for series in [9, 10]:\n        data_file_name = FNAME.format(subj, series, 'data')\n        x = pd.read_csv(data_file_name).iloc[:,1:].values\n        testset.append(x.T.astype(np.float32))\n        trial_len['{}_{}'.format(subj, series)] = testset[-1].shape[-1]\n        \ntestset = np.concatenate(testset, axis=1)","metadata":{"execution":{"iopub.status.busy":"2024-02-25T08:16:19.824688Z","iopub.status.idle":"2024-02-25T08:16:19.825027Z","shell.execute_reply.started":"2024-02-25T08:16:19.824842Z","shell.execute_reply":"2024-02-25T08:16:19.824857Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"testset = EEGSignalTestset(testset, m, s)\ndataloader = DataLoader(testset, batch_size = opt.batch_size,\\\n                                       num_workers = opt.n_cpu, shuffle=False)","metadata":{"execution":{"iopub.status.busy":"2024-02-25T08:16:19.828315Z","iopub.status.idle":"2024-02-25T08:16:19.828624Z","shell.execute_reply.started":"2024-02-25T08:16:19.828470Z","shell.execute_reply":"2024-02-25T08:16:19.828485Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_pred = []\nwith torch.no_grad():\n    for x in tqdm(dataloader):\n        x = x.to(device)\n        pred = nnet(x).detach().cpu().numpy()\n        y_pred.append(pred)\n        \ny_pred = np.concatenate(y_pred, axis=0).squeeze(axis=-1)","metadata":{"execution":{"iopub.status.busy":"2024-02-25T08:16:19.826783Z","iopub.status.idle":"2024-02-25T08:16:19.827146Z","shell.execute_reply.started":"2024-02-25T08:16:19.826968Z","shell.execute_reply":"2024-02-25T08:16:19.826987Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission = pd.DataFrame(y_pred, index=\\\n    ['subj{}_series{}_{}'.format(sbj, i, j) for sbj in range(1,13) for i in [9,10] for j in range(trial_len['{}_{}'.format(sbj, i)])],\\\n                         columns=labels)\nsubmission.to_csv('Submission.csv',index_label='id',float_format='%.3f')","metadata":{"execution":{"iopub.status.busy":"2024-02-25T08:16:19.830173Z","iopub.status.idle":"2024-02-25T08:16:19.830519Z","shell.execute_reply.started":"2024-02-25T08:16:19.830338Z","shell.execute_reply":"2024-02-25T08:16:19.830370Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"a = pd.read_csv('Submission.csv')\nprint(a[1:6])\n","metadata":{"execution":{"iopub.status.busy":"2024-02-25T09:56:21.712159Z","iopub.execute_input":"2024-02-25T09:56:21.713000Z","iopub.status.idle":"2024-02-25T09:56:25.380696Z","shell.execute_reply.started":"2024-02-25T09:56:21.712967Z","shell.execute_reply":"2024-02-25T09:56:25.379777Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"try:\n    shutil.rmtree('./train')\n    shutil.rmtree('./test')\nexcept:\n    pass","metadata":{"execution":{"iopub.status.busy":"2024-02-25T08:16:19.833541Z","iopub.status.idle":"2024-02-25T08:16:19.833893Z","shell.execute_reply.started":"2024-02-25T08:16:19.833715Z","shell.execute_reply":"2024-02-25T08:16:19.833731Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}