{"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":"!pip install git+https://github.com/rwightman/pytorch-image-models.git","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import math\nimport sys\nimport gc\nsys.path.append('../input/timm-pytorch-image-models/pytorch-image-models-master/')\nfrom timm import create_model\nfrom fastai.vision.all import *\nfrom sklearn.model_selection import KFold\nfrom sklearn.model_selection import StratifiedKFold\nimport timm\nfrom torch.optim.swa_utils import AveragedModel, SWALR\nfrom torch.optim.lr_scheduler import CosineAnnealingLR\nfrom tqdm.notebook import tqdm","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:16.354272Z","iopub.execute_input":"2022-08-07T07:15:16.354827Z","iopub.status.idle":"2022-08-07T07:15:18.514087Z","shell.execute_reply.started":"2022-08-07T07:15:16.354695Z","shell.execute_reply":"2022-08-07T07:15:18.51287Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def seeder(seed=365):\n    set_seed(seed, reproducible=True)\n    torch.manual_seed(seed)\n    torch.cuda.manual_seed(seed)\n    torch.backends.cudnn.deterministic = True\n    torch.use_deterministic_algorithms = True\n\nseed = 365\nBATCH_SIZE = 32\nIM_SIZ = 224\nN_FOLDS = 5\nEPOCHS = 5\nLR = 2e-5\nMODEL_NAME = 'efficientnet_b5'\nFOLD_NUM = 1\n# SWA_FLAG = True\nSWA_FLAG = False\n\nseeder(seed)\n\nITEM_TFMS = Resize(IM_SIZ)\nBATCH_TFMS = setup_aug_tfms([Brightness(), Contrast(), Hue(), Saturation(), RandomErasing()])\nAUG_TYPE = ''\n# AUG_TYPE = 'mixup'","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:18.516462Z","iopub.execute_input":"2022-08-07T07:15:18.518523Z","iopub.status.idle":"2022-08-07T07:15:18.533046Z","shell.execute_reply.started":"2022-08-07T07:15:18.518483Z","shell.execute_reply":"2022-08-07T07:15:18.531733Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_path = Path('../input/mayo-clinic-strip-ai/')\ndataset_path = Path('../input/jpg-images-strip-ai/')","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:18.5349Z","iopub.execute_input":"2022-08-07T07:15:18.535728Z","iopub.status.idle":"2022-08-07T07:15:18.543123Z","shell.execute_reply.started":"2022-08-07T07:15:18.53568Z","shell.execute_reply":"2022-08-07T07:15:18.542168Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ls_dir = os.listdir(dataset_path)\nif 'train.csv' in ls_dir:\n    print('Yes')\nelse:\n    print('no')","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:18.548994Z","iopub.execute_input":"2022-08-07T07:15:18.551023Z","iopub.status.idle":"2022-08-07T07:15:18.562345Z","shell.execute_reply.started":"2022-08-07T07:15:18.550986Z","shell.execute_reply":"2022-08-07T07:15:18.561011Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"seeder(seed)\ntrain_df = pd.read_csv(train_path/'train.csv')\ntrain_df['path'] = train_df['image_id'].map(lambda x:str(dataset_path/'train'/x)+'.jpg')\n# train_df = train_df.drop(columns=['image_id'])\ntrain_df = train_df.sample(frac=1, random_state= seed).reset_index(drop=True) #shuffle dataframe\ntrain_df.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:18.564147Z","iopub.execute_input":"2022-08-07T07:15:18.564819Z","iopub.status.idle":"2022-08-07T07:15:18.608965Z","shell.execute_reply.started":"2022-08-07T07:15:18.564765Z","shell.execute_reply":"2022-08-07T07:15:18.608039Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"seeder(seed)\nnum_bins = int(np.ceil(2*((len(train_df))**(1./3))))\nnum_bins","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:18.613038Z","iopub.execute_input":"2022-08-07T07:15:18.615265Z","iopub.status.idle":"2022-08-07T07:15:18.628654Z","shell.execute_reply.started":"2022-08-07T07:15:18.615228Z","shell.execute_reply":"2022-08-07T07:15:18.627021Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df['bins'] = pd.cut(train_df['image_num'], bins=num_bins, labels=False)\ntrain_df['bins'].hist()","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:18.633238Z","iopub.execute_input":"2022-08-07T07:15:18.635582Z","iopub.status.idle":"2022-08-07T07:15:18.924907Z","shell.execute_reply.started":"2022-08-07T07:15:18.635545Z","shell.execute_reply":"2022-08-07T07:15:18.923999Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# train_df[\"label\"] = (train_df[\"label\"] == \"LAA\").astype(\"uint8\")\n# train_df['fold'] = -1\n# RANDOM_STATE = 42\n# FILES_PER_FOLD = 16\n# np.random.seed(RANDOM_STATE)\n# kfold = StratifiedKFold(n_splits=N_FOLDS, shuffle=True, random_state=RANDOM_STATE)\n\n# with tqdm(total=N_FOLDS * FILES_PER_FOLD) as bar:\n#     for i, (_, index) in enumerate(\n#         kfold.split(\n#             train_df[\"image_id\"],\n#             train_df[\"label\"],\n#             groups=train_df[\"patient_id\"],\n#         ),\n#     ):\n#         train_df.iloc[index, -1] = i\n    \n# train_df['fold'] = train_df['fold'].astype('int')\n\n# train_df.fold.value_counts().plot.bar()","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:18.929168Z","iopub.execute_input":"2022-08-07T07:15:18.931451Z","iopub.status.idle":"2022-08-07T07:15:18.938257Z","shell.execute_reply.started":"2022-08-07T07:15:18.931401Z","shell.execute_reply":"2022-08-07T07:15:18.93715Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# seeder(seed)\n# # train_df['fold'] = -1\n# groups=train_df[\"center_id\"].values\n# strat_kfold = StratifiedKFold(n_splits=N_FOLDS, random_state=seed, shuffle=True)\n# train_df = train_df.copy(deep=True)\n# for i, (train_index, val_index) in enumerate(strat_kfold.split(train_df, train_df['label'].values,groups)):\n    \n# #     train_df.iloc[train_index, -1] = i\n    \n#     train_df.loc[val_index, \"Fold\"] = i\n\n#         # check\n#     train_groups, val_groups = groups[train_index], groups[val_index]\n# #     assert len(set(train_groups) & set(val_groups)) == 0\n\n# train_df = train_df.astype({\"Fold\": 'int64'})\n\n    \n# # train_df['fold'] = train_df['fold'].astype('int')\n\n# # train_df.fold.value_counts().plot.bar()","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:18.943428Z","iopub.execute_input":"2022-08-07T07:15:18.945933Z","iopub.status.idle":"2022-08-07T07:15:18.950754Z","shell.execute_reply.started":"2022-08-07T07:15:18.945895Z","shell.execute_reply":"2022-08-07T07:15:18.94968Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"seeder(seed)\ntrain_df['fold'] = -1\n\nstrat_kfold = StratifiedKFold(n_splits=N_FOLDS, random_state=seed, shuffle=True)\nfor i, (_, train_index) in enumerate(strat_kfold.split(train_df.index, train_df['bins'])):\n    train_df.iloc[train_index, -1] = i\n    \ntrain_df['fold'] = train_df['fold'].astype('int')\n\ntrain_df.fold.value_counts().plot.bar()","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:18.956096Z","iopub.execute_input":"2022-08-07T07:15:18.956906Z","iopub.status.idle":"2022-08-07T07:15:19.19571Z","shell.execute_reply.started":"2022-08-07T07:15:18.956861Z","shell.execute_reply":"2022-08-07T07:15:19.194551Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(train_groups),len(val_groups),np.unique(train_groups),np.unique(val_groups)","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:19.197138Z","iopub.execute_input":"2022-08-07T07:15:19.197502Z","iopub.status.idle":"2022-08-07T07:15:19.47115Z","shell.execute_reply.started":"2022-08-07T07:15:19.197465Z","shell.execute_reply":"2022-08-07T07:15:19.468622Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:19.474127Z","iopub.status.idle":"2022-08-07T07:15:19.47658Z","shell.execute_reply.started":"2022-08-07T07:15:19.476301Z","shell.execute_reply":"2022-08-07T07:15:19.476328Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def get_data(fold):\n    seeder(seed)\n    train_df_f = train_df.copy()\n    train_df_f['is_valid'] = (train_df_f['Fold'] == fold)\n    train_df_f[\"label\"] = (train_df_f[\"label\"] == \"LAA\").astype(\"uint8\")\n#     train_df_f[\"label\"] = (train_df_f[\"label\"] == \"CE\").astype(\"uint8\")\n    dls = ImageDataLoaders.from_df(train_df_f, \n                                   valid_col='is_valid',\n                                   seed=seed,\n                                   fn_col='path', #filename/path is in the second column of the DataFrame\n                                   label_col='label', #label is in the first column of the DataFrame\n                                   y_block=RegressionBlock, #The type of target\n                                   bs=BATCH_SIZE, #pass in batch size\n                                   num_workers=8,\n                                   item_tfms=ITEM_TFMS,\n                                   batch_tfms=BATCH_TFMS) #pass in batch_tfms\n    seeder(seed)\n    return dls","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:19.480678Z","iopub.status.idle":"2022-08-07T07:15:19.483105Z","shell.execute_reply.started":"2022-08-07T07:15:19.482827Z","shell.execute_reply":"2022-08-07T07:15:19.482855Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"the_data = get_data(0)\nassert (len(the_data.train) + len(the_data.valid)) == (len(train_df)//BATCH_SIZE)\n# assert len(the_data.train)+len(the_data.valid) == np.round((len(train_df)/BATCH_SIZE))\nlen(the_data.train),len(the_data.valid),(len(train_df)/BATCH_SIZE)","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:19.484503Z","iopub.status.idle":"2022-08-07T07:15:19.485284Z","shell.execute_reply.started":"2022-08-07T07:15:19.485027Z","shell.execute_reply":"2022-08-07T07:15:19.485052Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"the_data.show_batch()","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:19.490727Z","iopub.status.idle":"2022-08-07T07:15:19.491548Z","shell.execute_reply.started":"2022-08-07T07:15:19.491283Z","shell.execute_reply":"2022-08-07T07:15:19.491309Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"bias_value = the_data.train.items.label.mean()","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:19.492946Z","iopub.status.idle":"2022-08-07T07:15:19.493731Z","shell.execute_reply.started":"2022-08-07T07:15:19.493464Z","shell.execute_reply":"2022-08-07T07:15:19.493489Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sigmoid = nn.Sigmoid()\n\nclass Swish(torch.autograd.Function):\n    @staticmethod\n    def forward(ctx, i):\n        result = i * sigmoid(i)\n        ctx.save_for_backward(i)\n        return result\n    @staticmethod\n    def backward(ctx, grad_output):\n        i = ctx.saved_variables[0]\n        sigmoid_i = sigmoid(i)\n        return grad_output * (sigmoid_i * (1 + i * (1 - sigmoid_i)))\n\n\nclass Swish_Module(nn.Module):\n    def forward(self, x):\n        return Swish.apply(x)","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:19.495188Z","iopub.status.idle":"2022-08-07T07:15:19.502161Z","shell.execute_reply.started":"2022-08-07T07:15:19.501884Z","shell.execute_reply":"2022-08-07T07:15:19.50191Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class CombinationLoss(Module):\n    \"Cross Entropy Loss on multiple targets\"\n    def __init__(self):\n        self.func1 = MSELossFlat()\n        self.func2 = BCEWithLogitsLossFlat()\n#         self.func2 = MSELossFlat()\n#         self.func1 = BCEWithLogitsLossFlat()\n\n#     def forward(self, xs, ys, reduction='mean'):\n#         return self.func1(xs.squeeze(), ys.float()) + self.func2(torch.sigmoid(xs.squeeze()), ys.float())\n\n#     def forward(self, xs, ys, reduction='mean'):\n#         return self.func1(xs[0].squeeze(), ys.float()) + \\\n#                self.func2(torch.sigmoid(xs[1].squeeze()), ys.float())\n\n    def forward(self, xs, ys, reduction='mean'):\n        return self.func1(torch.sigmoid(xs[0].squeeze()), ys.float()) + \\\n               self.func2(xs[1].squeeze(), ys.float())","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:19.503552Z","iopub.status.idle":"2022-08-07T07:15:19.504347Z","shell.execute_reply.started":"2022-08-07T07:15:19.504083Z","shell.execute_reply":"2022-08-07T07:15:19.504109Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class CombinationLoss(Module):\n    \"Cross Entropy Loss on multiple targets\"\n    def __init__(self):\n        self.func1 = MSELossFlat()\n        self.func2 = BCEWithLogitsLossFlat()\n#         self.func2 = MSELossFlat()\n#         self.func1 = BCEWithLogitsLossFlat()\n\n#     def forward(self, xs, ys, reduction='mean'):\n#         return self.func1(xs.squeeze(), ys.float()) + self.func2(torch.sigmoid(xs.squeeze()), ys.float())\n\n#     def forward(self, xs, ys, reduction='mean'):\n#         return self.func1(xs[0].squeeze(), ys.float()) + \\\n#                self.func2(torch.sigmoid(xs[1].squeeze()), ys.float())\n\n    def forward(self, xs, ys, reduction='mean'):\n        return self.func1(torch.sigmoid(xs[0].squeeze()), ys.float()) + \\\n               self.func2(xs[1].squeeze(), ys.float())","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:19.505725Z","iopub.status.idle":"2022-08-07T07:15:19.506506Z","shell.execute_reply.started":"2022-08-07T07:15:19.506239Z","shell.execute_reply":"2022-08-07T07:15:19.506264Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class CustomModel(nn.Module):\n\n    def __init__(self, pretrained=True):\n        super().__init__()\n        NUM = 4096 \n        model = create_model(MODEL_NAME, pretrained=pretrained, num_classes=2)\n        ns = int (model.classifier.in_features *2)\n        \n        ll = list(enumerate(model.children()))\n        cut = next(i for i,o in reversed(ll) if has_pool_type(o))\n        \n        self.emb = nn.Sequential(*list(model.children())[:cut])\n        self.pools = nn.Sequential(AdaptiveConcatPool1d(),\n                                   Flatten(),\n                                   nn.Linear(ns, NUM),\n                                   Swish_Module())\n        \n        self.dropouts = nn.ModuleList([nn.Dropout(0.5) for _ in range(5)])\n        self.myfc = nn.Linear(NUM, 2)\n        self.myfc.bias.data = torch.Tensor([bias_value])\n        \n    def forward(self, x):\n        x = self.emb(x)\n        x = self.pools(x.transpose(1, 2))\n\n        for i, dropout in enumerate(self.dropouts):\n            if i == 0:\n                out = self.myfc(dropout(x))\n            else:\n                out += self.myfc(dropout(x))\n\n        out /= len(self.dropouts)\n\n        return [out[:,0], out[:, 1]]\n#         return out","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:19.507967Z","iopub.status.idle":"2022-08-07T07:15:19.508725Z","shell.execute_reply.started":"2022-08-07T07:15:19.50846Z","shell.execute_reply":"2022-08-07T07:15:19.508485Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def get_learner(fold_num):\n    seeder(seed)\n    dls = get_data(fold_num)\n    \n    seeder(seed)\n    model = CustomModel()\n\n    seeder(seed)\n    learn = Learner(dls,\n                    model,\n                    opt_func = ranger,\n                    loss_func = CombinationLoss(),\n#                     loss_func=BCEWithLogitsLossFlat(),\n#                     metrics=[petfinder_rmse]\n                    metrics=['accuacy','precision']\n                   ).to_fp16()\n    return learn, dls","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:19.510126Z","iopub.status.idle":"2022-08-07T07:15:19.510928Z","shell.execute_reply.started":"2022-08-07T07:15:19.510638Z","shell.execute_reply":"2022-08-07T07:15:19.510662Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"if AUG_TYPE == 'cutmix':\n    AUG = CutMix(alpha=1.0)\nelif AUG_TYPE == 'mixup':\n    AUG = MixUp(alpha=1.0)\nelse:\n    AUG = None\n    \nif AUG:\n    CBS=[SaveModelCallback(),\n         AUG,\n         EarlyStoppingCallback(monitor='accuracy',comp=np.less,patience=2)]\nelse:\n    CBS=[SaveModelCallback(),\n         EarlyStoppingCallback(monitor='accuracy',comp=np.less,patience=2)]\nCBS","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:19.51878Z","iopub.status.idle":"2022-08-07T07:15:19.519561Z","shell.execute_reply.started":"2022-08-07T07:15:19.519297Z","shell.execute_reply":"2022-08-07T07:15:19.519321Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class SWACallback(Callback):        \n    def before_fit(self):\n        self.swa_ = AveragedModel(self.learn.model)\n        self.learn.swa_model = None\n    def after_epoch(self):\n        self.swa_.update_parameters(learn.model)\n        self.learn.swa_model = self.swa_   ","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:19.520975Z","iopub.status.idle":"2022-08-07T07:15:19.521747Z","shell.execute_reply.started":"2022-08-07T07:15:19.521484Z","shell.execute_reply":"2022-08-07T07:15:19.521508Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"_before_epoch = [event.before_fit, event.before_epoch]\n_after_epoch  = [event.after_epoch, event.after_fit]\n\n@patch\ndef dual_tta(self:Learner, ds_idx=1, dl=None, n=4, item_tfms=None, batch_tfms=None, beta=0.25, use_max=False):\n    \"Return predictions on the `ds_idx` dataset or `dl` using Test Time Augmentation\"\n    if dl is None: dl = self.dls[ds_idx].new(shuffled=False, drop_last=False)\n    if item_tfms is not None or batch_tfms is not None: dl = dl.new(after_item=item_tfms, after_batch=batch_tfms)\n    try:\n        self(_before_epoch)\n        with dl.dataset.set_split_idx(0), self.no_mbar():\n            if hasattr(self,'progress'): self.progress.mbar = master_bar(list(range(n)))\n            aug_preds = []\n            for i in self.progress.mbar if hasattr(self,'progress') else range(n):\n                self.epoch = i #To keep track of progress on mbar since the progress callback will use self.epoch\n                res = self.get_preds(dl=dl, inner=True)[0][0][None]\n                aug_preds.append(res)\n        aug_preds = torch.cat(aug_preds)\n        aug_preds = aug_preds.max(0)[0] if use_max else aug_preds.mean(0)\n        self.epoch = n\n        with dl.dataset.set_split_idx(1): preds,targs = self.get_preds(dl=dl, inner=True)\n    finally: self(event.after_fit)\n\n    if use_max: return torch.stack([preds, aug_preds], 0).max(0)[0],targs\n    preds = (aug_preds,preds) if beta is None else torch.lerp(aug_preds, preds[0], beta)\n    return preds,targs","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:19.523199Z","iopub.status.idle":"2022-08-07T07:15:19.523993Z","shell.execute_reply.started":"2022-08-07T07:15:19.523706Z","shell.execute_reply":"2022-08-07T07:15:19.523731Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"all_preds = []\n\nfor i in [FOLD_NUM]:\n\n    ## Setup Training\n    print(f'Fold {i} results')\n    seeder(seed)\n    learn, dls = get_learner(fold_num=i)\n    print(learn.opt_func)\n\n    ## Training\n    seeder(seed)\n    learn.fit_one_cycle(EPOCHS, LR,cbs=CBS)\n    learn.recorder.plot_loss()\n\n    preds, y = learn.get_preds()\n    \n#     ## SWA Training \n#     seeder(seed)\n#     learn.fit_one_cycle(4, 1e-6, cbs=CBS + [SWACallback()])\n#     if SWA_FLAG:\n#         learn.model = learn.swa_model\n#         learn.swa_model = None\n    \n#     ## Final BN Training\n#     learn.freeze_to(1)\n#     seeder(seed)    \n#     learn.fit_one_cycle(1, 1e-6, cbs=CBS)\n    \n    ## Adding Test Cases    \n    test_dl = dls.test_dl(test_df)\n\n    ## Inference for Test Cases    \n    preds, _ = learn.dual_tta(dl=test_dl, n=5, beta=0)\n    all_preds.append(preds)\n    \n    # Clean up\n    learn = None    \n    del learn\n    torch.cuda.empty_cache()\n    gc.collect()","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:19.525378Z","iopub.status.idle":"2022-08-07T07:15:19.526154Z","shell.execute_reply.started":"2022-08-07T07:15:19.525888Z","shell.execute_reply":"2022-08-07T07:15:19.525913Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"np.unique(train_df[\"label\"])","metadata":{"execution":{"iopub.status.busy":"2022-08-07T07:15:19.527523Z","iopub.status.idle":"2022-08-07T07:15:19.535165Z","shell.execute_reply.started":"2022-08-07T07:15:19.534885Z","shell.execute_reply":"2022-08-07T07:15:19.534911Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}