{"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":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 5GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-04-28T07:05:59.763202Z","iopub.execute_input":"2023-04-28T07:05:59.763700Z","iopub.status.idle":"2023-04-28T07:05:59.773546Z","shell.execute_reply.started":"2023-04-28T07:05:59.763643Z","shell.execute_reply":"2023-04-28T07:05:59.772552Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip install torchsummary","metadata":{"execution":{"iopub.status.busy":"2023-04-28T07:05:59.775555Z","iopub.execute_input":"2023-04-28T07:05:59.776074Z","iopub.status.idle":"2023-04-28T07:06:05.410924Z","shell.execute_reply.started":"2023-04-28T07:05:59.776038Z","shell.execute_reply":"2023-04-28T07:06:05.409737Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Importing Libraries\nimport torch\nimport torchvision\nimport torchvision.transforms as transforms\nfrom torchsummary import summary\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport torch.optim as optim\nfrom torch.optim.lr_scheduler import StepLR, ReduceLROnPlateau\n\nimport matplotlib.pyplot as plt\n%matplotlib inline\n\ndevice = \"cuda\" if torch.cuda.is_available else \"cpu\"\nprint(device)","metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","execution":{"iopub.status.busy":"2023-04-28T07:06:05.413933Z","iopub.execute_input":"2023-04-28T07:06:05.414333Z","iopub.status.idle":"2023-04-28T07:06:05.426641Z","shell.execute_reply.started":"2023-04-28T07:06:05.414289Z","shell.execute_reply":"2023-04-28T07:06:05.425688Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from torchvision import transforms\nimport numpy as np\nimport torch\n\n# Returns a list of transformations when called\n\nclass GetTransforms():\n    '''Returns a list of transformations when type as requested amongst train/test\n       Transforms('train') = list of transforms to apply on training data\n       Transforms('test') = list of transforms to apply on testing data'''\n\n    def __init__(self):\n        pass\n\n    def trainparams(self):\n        train_transformations = [ #resises the image so it can be perfect for our model.\n#             transforms.TrivialAugmentWide(interpolation=transforms.InterpolationMode.BILINEAR),\n#             transforms.RandomHorizontalFlip(),\n            transforms.RandomCrop(32, padding=4),\n\n            transforms.RandomHorizontalFlip(), # FLips the image w.r.t horizontal axis\n            transforms.RandomRotation((-7,7)),     #Rotates the image to a specified angel\n            transforms.RandomAffine(0, shear=10, scale=(0.8,1.2)), #Performs actions like zooms, change shear angles.\n            transforms.ColorJitter(brightness=0.2, contrast=0.2, saturation=0.2), # Set the color params\n            transforms.ToTensor(), # comvert the image to tensor so that it can work with torch\n            transforms.Normalize((0.491, 0.482, 0.446), (0.247, 0.243, 0.261)) #Normalize all the images\n            ]\n\n        return train_transformations\n\n    def testparams(self):\n        test_transforms = [\n            transforms.ToTensor(),\n            transforms.Normalize((0.491, 0.482, 0.446), (0.247, 0.243, 0.261))\n        ]\n        return test_transforms","metadata":{"execution":{"iopub.status.busy":"2023-04-28T07:06:05.428223Z","iopub.execute_input":"2023-04-28T07:06:05.428545Z","iopub.status.idle":"2023-04-28T07:06:05.440122Z","shell.execute_reply.started":"2023-04-28T07:06:05.428510Z","shell.execute_reply":"2023-04-28T07:06:05.439177Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from torchvision import datasets\nfrom torchvision import transforms\n\n\ntransformations = GetTransforms()\ntrain_transforms = transforms.Compose(transformations.trainparams())\ntest_transforms = transforms.Compose(transformations.testparams())\n\n\nclass GetCIFAR10_TrainData():\n    def __init__(self, dir_name:str):\n        self.dirname = dir_name\n\n    def download_train_data(self):\n        return datasets.CIFAR10('./data', train=True, download=True, transform=train_transforms)\n\n    def download_test_data(self):\n        return datasets.CIFAR10('./data', train=False, download=True, transform=test_transforms)\n","metadata":{"execution":{"iopub.status.busy":"2023-04-28T07:06:05.442554Z","iopub.execute_input":"2023-04-28T07:06:05.442830Z","iopub.status.idle":"2023-04-28T07:06:05.452242Z","shell.execute_reply.started":"2023-04-28T07:06:05.442806Z","shell.execute_reply":"2023-04-28T07:06:05.451402Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data = GetCIFAR10_TrainData(os.chdir(\"..\"))\ntrainset = data.download_train_data()\ntestset = data.download_test_data()\ntrainloader = torch.utils.data.DataLoader(trainset, batch_size=512,\n                                          shuffle=True, num_workers=4)\ntestloader = torch.utils.data.DataLoader(testset, batch_size=512,\n                                         shuffle=False, num_workers=4)","metadata":{"execution":{"iopub.status.busy":"2023-04-28T07:06:05.455230Z","iopub.execute_input":"2023-04-28T07:06:05.455559Z","iopub.status.idle":"2023-04-28T07:06:21.790994Z","shell.execute_reply.started":"2023-04-28T07:06:05.455530Z","shell.execute_reply":"2023-04-28T07:06:21.790089Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# The Model - RESNET18\n","metadata":{}},{"cell_type":"code","source":"class BasicBlock(nn.Module):\n    expansion = 1\n    \n\n    def __init__(self, in_planes, planes, stride=1):\n        super(BasicBlock, self).__init__()\n\n        DROPOUT = 0.1\n\n        self.conv1 = nn.Conv2d(\n            in_planes, planes, kernel_size=3, stride=stride, padding=1, bias=False)\n        self.bn1 = nn.BatchNorm2d(planes)\n        self.dropout = nn.Dropout(DROPOUT)\n        self.conv2 = nn.Conv2d(planes, planes, kernel_size=3,\n                               stride=1, padding=1, bias=False)\n        self.bn2 = nn.BatchNorm2d(planes)\n        self.dropout = nn.Dropout(DROPOUT)\n\n        self.shortcut = nn.Sequential()\n        if stride != 1 or in_planes != self.expansion*planes:\n            self.shortcut = nn.Sequential(\n                nn.Conv2d(in_planes, self.expansion*planes,\n                          kernel_size=1, stride=stride, bias=False),\n                nn.BatchNorm2d(self.expansion*planes),\n                nn.Dropout(DROPOUT)\n            )\n\n    def forward(self, x):\n        out = F.relu(self.dropout(self.bn1(self.conv1(x))))\n        out = self.dropout(self.bn2(self.conv2(out)))\n        out += self.shortcut(x)\n        out = F.relu(out)\n        return out\n\n\nclass ResNet(nn.Module):\n    def __init__(self, block, num_blocks, num_classes=10):\n        super(ResNet, self).__init__()\n        self.in_planes = 64\n\n        self.conv1 = nn.Conv2d(3, 64, kernel_size=3,\n                               stride=1, padding=1, bias=False)\n        self.bn1 = nn.BatchNorm2d(64)\n        self.layer1 = self._make_layer(block, 64, num_blocks[0], stride=1)\n        self.layer2 = self._make_layer(block, 128, num_blocks[1], stride=2)\n        self.layer3 = self._make_layer(block, 256, num_blocks[2], stride=2)\n        self.layer4 = self._make_layer(block, 512, num_blocks[3], stride=2)\n        self.linear = nn.Linear(512*block.expansion, num_classes)\n\n    def _make_layer(self, block, planes, num_blocks, stride):\n        strides = [stride] + [1]*(num_blocks-1)\n        layers = []\n        for stride in strides:\n            layers.append(block(self.in_planes, planes, stride))\n            self.in_planes = planes * block.expansion\n        return nn.Sequential(*layers)\n\n    def forward(self, x):\n        out = F.relu(self.bn1(self.conv1(x)))\n        out = self.layer1(out)\n        out = self.layer2(out)\n        out = self.layer3(out)\n        out = self.layer4(out)\n        out = F.avg_pool2d(out, 4)\n        out = out.view(out.size(0), -1)\n        out = self.linear(out)\n        return F.log_softmax(out, dim=-1)\n\n\ndef ResNet18():\n    return ResNet(BasicBlock, [2, 2, 2, 2])","metadata":{"execution":{"iopub.status.busy":"2023-04-28T07:06:21.792342Z","iopub.execute_input":"2023-04-28T07:06:21.792691Z","iopub.status.idle":"2023-04-28T07:06:21.812514Z","shell.execute_reply.started":"2023-04-28T07:06:21.792655Z","shell.execute_reply":"2023-04-28T07:06:21.811548Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Importing Model and printing Summary\nmodel = ResNet18().to(device)\nsummary(model, input_size=(3,32,32))","metadata":{"execution":{"iopub.status.busy":"2023-04-28T07:06:21.814227Z","iopub.execute_input":"2023-04-28T07:06:21.814701Z","iopub.status.idle":"2023-04-28T07:06:25.600847Z","shell.execute_reply.started":"2023-04-28T07:06:21.814666Z","shell.execute_reply":"2023-04-28T07:06:25.599640Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from tqdm import tqdm\nfrom torch import nn\nimport torch.nn\nfrom torch.functional import F\nimport os\n\n\ndef model_training(model, device, train_dataloader, optimizer, train_acc, train_losses):\n            \n    model.train()\n    pbar = tqdm(train_dataloader)\n    correct = 0\n    processed = 0\n    running_loss = 0.0\n\n    for batch_idx, (data, target) in enumerate(pbar):\n        data, target = data.to(device), target.to(device)\n        optimizer.zero_grad()\n        y_pred = model(data)\n        loss = F.nll_loss(y_pred, target)\n        \n\n        train_losses.append(loss)\n        loss.backward()\n        optimizer.step()\n\n        pred = y_pred.argmax(dim=1, keepdim=True)\n        correct += pred.eq(target.view_as(pred)).sum().item()\n        processed += len(data)\n        # print statistics\n        running_loss += loss.item()\n        pbar.set_description(desc=f'Loss={loss.item()} Batch_id={batch_idx} Accuracy={100*correct/processed:0.2f}')\n        train_acc.append(100*correct/processed)","metadata":{"execution":{"iopub.status.busy":"2023-04-28T07:06:25.602491Z","iopub.execute_input":"2023-04-28T07:06:25.602853Z","iopub.status.idle":"2023-04-28T07:06:25.619683Z","shell.execute_reply.started":"2023-04-28T07:06:25.602815Z","shell.execute_reply":"2023-04-28T07:06:25.618969Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import torch\nimport os\nfrom torch.functional import F\n\ncwd = os.getcwd()\n\ndef model_testing(model, device, test_dataloader, test_acc, test_losses, misclassified = []):\n    \n    model.eval()\n    test_loss = 0\n    correct = 0\n    class_correct = list(0. for i in range(10))\n    class_total = list(0. for i in range(10))\n    # label = 0\n    classes = ('plane', 'car', 'bird', 'cat',\n           'deer', 'dog', 'frog', 'horse', 'ship', 'truck')\n    \n    with torch.no_grad():\n\n        for index, (data, target) in enumerate(test_dataloader):\n            data, target = data.to(device), target.to(device)\n            output = model(data)\n            pred = output.argmax(dim=1, keepdim=True)\n            \n            for d,i,j in zip(data, pred, target):\n                if i != j:\n                    misclassified.append([d.cpu(),i[0].cpu(),j.cpu()])\n\n            test_loss += F.nll_loss(output, target, reduction='sum').item()\n            correct += pred.eq(target.view_as(pred)).sum().item()\n    test_loss /= len(test_dataloader.dataset)\n    test_losses.append(test_loss)\n    \n    print('\\nTest set: Average loss: {:.4f}, Accuracy: {}/{} ({:.2f}%)\\n'.format(\n        test_loss, correct, len(test_dataloader.dataset),\n        100. * correct / len(test_dataloader.dataset)))\n    \n    test_acc.append(100. * correct / len(test_dataloader.dataset))\n    return misclassified","metadata":{"execution":{"iopub.status.busy":"2023-04-28T07:06:25.621117Z","iopub.execute_input":"2023-04-28T07:06:25.621522Z","iopub.status.idle":"2023-04-28T07:06:25.934363Z","shell.execute_reply.started":"2023-04-28T07:06:25.621484Z","shell.execute_reply":"2023-04-28T07:06:25.933385Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Training the model\n\ncriterion = nn.CrossEntropyLoss()\noptimizer = optim.SGD(model.parameters(), lr=0.01, momentum=0.9)\n# optimizer = optim.Adam(model.parameters(), lr=0.01)\nscheduler = ReduceLROnPlateau(optimizer, mode='min', factor=0.05, patience=2, threshold=0.0001, threshold_mode='rel', cooldown=0, min_lr=0, eps=1e-08, verbose=True)\n\ntrain_acc = []\ntrain_losses = []\ntest_acc = []\ntest_losses = []\n\nEPOCHS = 40\n\nfor i in range(EPOCHS):\n    print(f'EPOCHS : {i}')\n    model_training(model, device, trainloader, optimizer, train_acc, train_losses)\n    scheduler.step(train_losses[-1])\n    misclassified = model_testing(model, device, testloader, test_acc, test_losses)","metadata":{"execution":{"iopub.status.busy":"2023-04-28T09:11:06.781172Z","iopub.execute_input":"2023-04-28T09:11:06.781499Z","iopub.status.idle":"2023-04-28T09:33:18.665834Z","shell.execute_reply.started":"2023-04-28T09:11:06.781469Z","shell.execute_reply":"2023-04-28T09:33:18.664872Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"max(test_acc)","metadata":{"execution":{"iopub.status.busy":"2023-04-28T09:34:40.673870Z","iopub.execute_input":"2023-04-28T09:34:40.674234Z","iopub.status.idle":"2023-04-28T09:34:40.682417Z","shell.execute_reply.started":"2023-04-28T09:34:40.674200Z","shell.execute_reply":"2023-04-28T09:34:40.681536Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"max(train_acc)","metadata":{"execution":{"iopub.status.busy":"2023-04-28T09:34:42.726806Z","iopub.execute_input":"2023-04-28T09:34:42.727122Z","iopub.status.idle":"2023-04-28T09:34:42.733416Z","shell.execute_reply.started":"2023-04-28T09:34:42.727093Z","shell.execute_reply":"2023-04-28T09:34:42.732509Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, axs = plt.subplots(2,2, figsize=(25,20))\n\n\naxs[0,0].set_title('Train Losses')\naxs[0,1].set_title('Training Accuracy')\naxs[1,0].set_title('Test Losses')\naxs[1,1].set_title('Test Accuracy')\n\naxs[0,0].plot(train_losses)\naxs[0,1].plot(train_acc)\naxs[1,0].plot(test_losses)\naxs[1,1].plot(test_acc)\n\n# .title(\"Resnet18: tuning with Adam optim\")\nplt.savefig('/kaggle/working/training.png', dpi=600)","metadata":{"execution":{"iopub.status.busy":"2023-04-28T09:34:46.444632Z","iopub.execute_input":"2023-04-28T09:34:46.444953Z","iopub.status.idle":"2023-04-28T09:34:58.247044Z","shell.execute_reply.started":"2023-04-28T09:34:46.444922Z","shell.execute_reply":"2023-04-28T09:34:58.246220Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.metrics import confusion_matrix\nimport seaborn as sn","metadata":{"execution":{"iopub.status.busy":"2023-04-28T07:58:57.264020Z","iopub.execute_input":"2023-04-28T07:58:57.264351Z","iopub.status.idle":"2023-04-28T07:58:57.354640Z","shell.execute_reply.started":"2023-04-28T07:58:57.264318Z","shell.execute_reply":"2023-04-28T07:58:57.353897Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"classes = ('plane', 'car', 'bird', 'cat',\n           'deer', 'dog', 'frog', 'horse', 'ship', 'truck')\ny_pred = []\ny_true = []\n\nfor index, (data, target) in enumerate(testloader ):\n            data, target = data.to(device), target.to(device)\n            output = model(data)\n            pred = output.argmax(dim=1, keepdim=True)\n            \n#             print(pred)\n            pred = pred.data.cpu().numpy()\n            y_pred.extend((pred)) # Save Prediction\n\n            target = target.data.cpu().numpy()\n            y_true.extend((target)) # Save Truth\n#             print(target)\n# Build confusion \n\nprint(len(y_pred))\ncf_matrix = confusion_matrix(y_true, y_pred)\ndf_cm = pd.DataFrame(cf_matrix/np.sum(cf_matrix) *10, index = [i for i in classes],\n                     columns = [i for i in classes])\nplt.figure(figsize = (12,7))\nsn.heatmap(df_cm, annot=True)\nplt.title(\"Resnet18: tuning with SGD optim\")\nplt.savefig('/kaggle/working/output.png', dpi=600)","metadata":{"execution":{"iopub.status.busy":"2023-04-28T09:35:23.429098Z","iopub.execute_input":"2023-04-28T09:35:23.429435Z","iopub.status.idle":"2023-04-28T09:35:28.801461Z","shell.execute_reply.started":"2023-04-28T09:35:23.429403Z","shell.execute_reply":"2023-04-28T09:35:28.800495Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from torchvision.utils import make_grid","metadata":{"execution":{"iopub.status.busy":"2023-04-28T08:06:32.819200Z","iopub.execute_input":"2023-04-28T08:06:32.819670Z","iopub.status.idle":"2023-04-28T08:06:32.824797Z","shell.execute_reply.started":"2023-04-28T08:06:32.819627Z","shell.execute_reply":"2023-04-28T08:06:32.823823Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def show_batch(dl):\n    for images, labels in dl:\n        fig, ax = plt.subplots(figsize=(12, 12))\n        ax.set_xticks([]); ax.set_yticks([])\n        ax.imshow(make_grid(images[:64], nrow=8).permute(1, 2, 0))\n        break","metadata":{"execution":{"iopub.status.busy":"2023-04-28T08:06:34.696357Z","iopub.execute_input":"2023-04-28T08:06:34.696711Z","iopub.status.idle":"2023-04-28T08:06:34.702505Z","shell.execute_reply.started":"2023-04-28T08:06:34.696676Z","shell.execute_reply":"2023-04-28T08:06:34.701439Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"show_batch(trainloader)","metadata":{"execution":{"iopub.status.busy":"2023-04-28T08:06:36.569975Z","iopub.execute_input":"2023-04-28T08:06:36.570412Z","iopub.status.idle":"2023-04-28T08:06:39.240064Z","shell.execute_reply.started":"2023-04-28T08:06:36.570366Z","shell.execute_reply":"2023-04-28T08:06:39.238011Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mean, std = [0.4914, 0.4822, 0.4465], [0.247, 0.243, 0.261]\n# We need to convert the images to numpy arrays as tensors are not compatible with matplotlib.\ndef im_convert(tensor):\n    #Lets\n    img = tensor.cpu().clone().detach().numpy() #\n    img = img.transpose(1, 2, 0)\n    img = img * np.array(tuple(mean)) + np.array(tuple(std))\n    img = img.clip(0, 1) # Clipping the size to print the images later\n    return img","metadata":{"execution":{"iopub.status.busy":"2023-04-28T08:09:14.618042Z","iopub.execute_input":"2023-04-28T08:09:14.618419Z","iopub.status.idle":"2023-04-28T08:09:14.625173Z","shell.execute_reply.started":"2023-04-28T08:09:14.618384Z","shell.execute_reply":"2023-04-28T08:09:14.624304Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Different classes in CIPHAR 10 dataset. \nclasses = ('airplane', \n           'automobile', \n           'bird',\n           'cat',\n           'deer',\n           'dog', \n           'frog', \n           'horse', \n           'ship',\n           'truck')\n\n# Define an iterable on the data\ndata_iterable = iter(trainloader) # converting our train_dataloader to iterable so that we can iter through it. \nimages, labels = next(data_iterable) #going from 1st batch of 100 images to the next batch\nfig = plt.figure(figsize=(20, 10)) \n\n# Lets plot 50 images from our train_dataset\nfor idx in np.arange(10):\n    ax = fig.add_subplot(2, 5, idx+1, xticks=[], yticks=[])\n    \n    # Note: imshow cant print tensor !\n    # Lets convert tensor image to numpy using im_convert function for imshow to print the image\n    plt.imshow(im_convert(images[idx]))\n    ax.set_title(classes[labels[idx].item()])","metadata":{"execution":{"iopub.status.busy":"2023-04-28T08:09:17.886228Z","iopub.execute_input":"2023-04-28T08:09:17.886558Z","iopub.status.idle":"2023-04-28T08:09:20.618797Z","shell.execute_reply.started":"2023-04-28T08:09:17.886527Z","shell.execute_reply":"2023-04-28T08:09:20.617504Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def show_data(img):\n    try:\n        plt.imshow(img[0])\n    except Exception as e:\n        print(e)\n    print(img[0].shape, img[0].permute(1,2,0).shape)\n    plt.imshow(img[0].permute(1,2,0))\n    plt.title('y = '+ str(img[1]))\n    plt.show()","metadata":{"execution":{"iopub.status.busy":"2023-04-28T08:10:32.727216Z","iopub.execute_input":"2023-04-28T08:10:32.727642Z","iopub.status.idle":"2023-04-28T08:10:32.734815Z","shell.execute_reply.started":"2023-04-28T08:10:32.727597Z","shell.execute_reply":"2023-04-28T08:10:32.733860Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"show_data(trainset [100])","metadata":{"execution":{"iopub.status.busy":"2023-04-28T08:11:07.274444Z","iopub.execute_input":"2023-04-28T08:11:07.274830Z","iopub.status.idle":"2023-04-28T08:11:07.416538Z","shell.execute_reply.started":"2023-04-28T08:11:07.274795Z","shell.execute_reply":"2023-04-28T08:11:07.415418Z"},"trusted":true},"execution_count":null,"outputs":[]}]}