{"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":"import pandas as pd\nimport numpy as np\nimport os, cv2\nfrom IPython.display import Image\nfrom keras.preprocessing import image\nfrom keras import optimizers\nfrom keras import layers, models\nfrom keras.applications.imagenet_utils import preprocess_input\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nfrom keras import regularizers\nfrom keras.preprocessing.image import ImageDataGenerator\nfrom keras.applications.vgg16 import VGG16\nprint(os.listdir(\"../input/aerial-cactus-identification\"))","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-08-02T05:12:42.537399Z","iopub.execute_input":"2022-08-02T05:12:42.538240Z","iopub.status.idle":"2022-08-02T05:12:49.322154Z","shell.execute_reply.started":"2022-08-02T05:12:42.538205Z","shell.execute_reply":"2022-08-02T05:12:49.320986Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"os.listdir('.')","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:49.324705Z","iopub.execute_input":"2022-08-02T05:12:49.325335Z","iopub.status.idle":"2022-08-02T05:12:49.337670Z","shell.execute_reply.started":"2022-08-02T05:12:49.325296Z","shell.execute_reply":"2022-08-02T05:12:49.335884Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"os.getcwd()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:49.339407Z","iopub.execute_input":"2022-08-02T05:12:49.340061Z","iopub.status.idle":"2022-08-02T05:12:49.351526Z","shell.execute_reply.started":"2022-08-02T05:12:49.340024Z","shell.execute_reply":"2022-08-02T05:12:49.349287Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import zipfile\nwith zipfile.ZipFile(\"../input/aerial-cactus-identification/train.zip\", 'r') as zip_ref:\n    zip_ref.extractall(\".\")","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:49.354076Z","iopub.execute_input":"2022-08-02T05:12:49.354917Z","iopub.status.idle":"2022-08-02T05:12:52.112416Z","shell.execute_reply.started":"2022-08-02T05:12:49.354882Z","shell.execute_reply":"2022-08-02T05:12:52.111221Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import zipfile\nwith zipfile.ZipFile(\"../input/aerial-cactus-identification/test.zip\", 'r') as zip_ref:\n    zip_ref.extractall(\".\")","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:52.114436Z","iopub.execute_input":"2022-08-02T05:12:52.115140Z","iopub.status.idle":"2022-08-02T05:12:52.933807Z","shell.execute_reply.started":"2022-08-02T05:12:52.115101Z","shell.execute_reply":"2022-08-02T05:12:52.932713Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_dir = \"/kaggle/working/train\"\ntest_dir = \"/kaggle/working/test\"\ntrain = pd.read_csv('../input/aerial-cactus-identification/train.csv')\n\ndf_test = pd.read_csv('../input/aerial-cactus-identification/sample_submission.csv')","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:52.938527Z","iopub.execute_input":"2022-08-02T05:12:52.941162Z","iopub.status.idle":"2022-08-02T05:12:52.995049Z","shell.execute_reply.started":"2022-08-02T05:12:52.941121Z","shell.execute_reply":"2022-08-02T05:12:52.994142Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:52.999238Z","iopub.execute_input":"2022-08-02T05:12:53.001957Z","iopub.status.idle":"2022-08-02T05:12:53.022994Z","shell.execute_reply.started":"2022-08-02T05:12:53.001918Z","shell.execute_reply":"2022-08-02T05:12:53.022015Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.dtypes","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:53.026978Z","iopub.execute_input":"2022-08-02T05:12:53.029517Z","iopub.status.idle":"2022-08-02T05:12:53.041288Z","shell.execute_reply.started":"2022-08-02T05:12:53.029463Z","shell.execute_reply":"2022-08-02T05:12:53.040268Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.has_cactus = train.has_cactus.astype(str)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:53.044545Z","iopub.execute_input":"2022-08-02T05:12:53.048139Z","iopub.status.idle":"2022-08-02T05:12:53.074487Z","shell.execute_reply.started":"2022-08-02T05:12:53.048102Z","shell.execute_reply":"2022-08-02T05:12:53.073640Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('dataset has {} rows and {} columns'.format(train.shape[0], train.shape[1]))","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:53.081335Z","iopub.execute_input":"2022-08-02T05:12:53.081921Z","iopub.status.idle":"2022-08-02T05:12:53.092858Z","shell.execute_reply.started":"2022-08-02T05:12:53.081886Z","shell.execute_reply":"2022-08-02T05:12:53.091826Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train['has_cactus'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:53.097982Z","iopub.execute_input":"2022-08-02T05:12:53.098951Z","iopub.status.idle":"2022-08-02T05:12:53.117278Z","shell.execute_reply.started":"2022-08-02T05:12:53.098914Z","shell.execute_reply":"2022-08-02T05:12:53.116242Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('There are {} rows in test set'.format(len(os.listdir(test_dir))))","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:53.118583Z","iopub.execute_input":"2022-08-02T05:12:53.122610Z","iopub.status.idle":"2022-08-02T05:12:53.134836Z","shell.execute_reply.started":"2022-08-02T05:12:53.122574Z","shell.execute_reply":"2022-08-02T05:12:53.133262Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('There are {} rows in train set'.format(len(os.listdir(train_dir))))","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:53.136214Z","iopub.execute_input":"2022-08-02T05:12:53.136921Z","iopub.status.idle":"2022-08-02T05:12:53.164728Z","shell.execute_reply.started":"2022-08-02T05:12:53.136881Z","shell.execute_reply":"2022-08-02T05:12:53.163857Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('There are {} rows in submission data'.format((df_test.shape)[0]))","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:53.168645Z","iopub.execute_input":"2022-08-02T05:12:53.170844Z","iopub.status.idle":"2022-08-02T05:12:53.178926Z","shell.execute_reply.started":"2022-08-02T05:12:53.170809Z","shell.execute_reply":"2022-08-02T05:12:53.177846Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Image(os.path.join(train_dir, train.iloc[69,0]), \n      width=250, height=250)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:53.180418Z","iopub.execute_input":"2022-08-02T05:12:53.181095Z","iopub.status.idle":"2022-08-02T05:12:53.192797Z","shell.execute_reply.started":"2022-08-02T05:12:53.181061Z","shell.execute_reply":"2022-08-02T05:12:53.191791Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Data Preparation**\n\n\nAs you know, data should be processed into appropriately pre-processed floating point tensors before being fed to our network. So the steps for getting it into our network are roughly\n\n\n    * Read the picture files\n    * Decode JPEG content to RGB pixels\n    * Convert this into floating tensors\n    * Rescale pixel values (between 0 to 255) to [0,1] interval.","metadata":{}},{"cell_type":"code","source":"datagen = ImageDataGenerator(rescale=1./255)\nbatch_size=150","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:53.195888Z","iopub.execute_input":"2022-08-02T05:12:53.196982Z","iopub.status.idle":"2022-08-02T05:12:53.205573Z","shell.execute_reply.started":"2022-08-02T05:12:53.196941Z","shell.execute_reply":"2022-08-02T05:12:53.204576Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**flow_from_dataframe Method**\n\nThis method is useful whaen the images are clustered in only one folder. To put in other words images from different class/labels reside in only one folder. Generally, with such kind of data, some text files containing information on class and other parameters are provided. In this case, we will create a dataframe using pandas and text files provided, and create a meaningful dataframe with columns having file name (only the file names, not the path) and other classes to be used by the model. For this method, arguments to be used are:\n\n\n    * dataframe value: Dataframe having meaningful data (file name, class columns are a must)\n    * directory value : The path to the parent directory containing all images\n    * x_col value : which will be name of column ( in data frame) having file names.\n    * y_col value : which will be the name of column( in dataframe) having class / label","metadata":{}},{"cell_type":"code","source":"train_generator = datagen.flow_from_dataframe(dataframe=train[:15001],\n                                             directory = train_dir,\n                                             x_col='id',\n                                             y_col='has_cactus',\n                                             class_mode='binary',\n                                             batch_size=batch_size,\n                                             target_size=(150,150))\n\nvalidation_generator = datagen.flow_from_dataframe(dataframe=train[15000:],\n                                                  directory=train_dir,\n                                                  x_col='id',\n                                                  y_col='has_cactus',\n                                                  class_mode='binary',\n                                                  batch_size=50, \n                                                  target_size=(150, 150))","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:53.207045Z","iopub.execute_input":"2022-08-02T05:12:53.208738Z","iopub.status.idle":"2022-08-02T05:12:53.932398Z","shell.execute_reply.started":"2022-08-02T05:12:53.208701Z","shell.execute_reply":"2022-08-02T05:12:53.931440Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Splitting our train and validation dataset**\n\nNow, after preprocessing is done with our data we will split our dataset to training and validation for training our model and validating the result respectively. We will take first 15000 images to train our data and last 2500 images to validate our model later.\n\n\n\n","metadata":{}},{"cell_type":"markdown","source":"**Building our model**\n\nNow we will build our network. We will build our model such that it contains 5 **Conv2D + Maxpooling2D stages** with **relu** activation function. ","metadata":{}},{"cell_type":"code","source":"model = models.Sequential()\nmodel.add(layers.Conv2D(32, (3,3), activation='relu', \n                        input_shape=(150, 150, 3)))\nmodel.add(layers.MaxPool2D((2,2)))\nmodel.add(layers.Conv2D(64, (3,3), activation='relu',\n                       input_shape=(150, 150,3)))\nmodel.add(layers.MaxPool2D((2,2)))\nmodel.add(layers.Conv2D(128,(3,3),activation='relu',\n                       input_shape=(150,150,3)))\nmodel.add(layers.MaxPool2D((2,2)))\nmodel.add(layers.Conv2D(128, (3,3), activation='relu',\n                       input_shape=(150,150,3)))\nmodel.add(layers.MaxPool2D((2,2)))\nmodel.add(layers.Flatten())\nmodel.add(layers.Dense(512,activation='relu'))\nmodel.add(layers.Dense(1,activation='sigmoid'))","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:53.936613Z","iopub.execute_input":"2022-08-02T05:12:53.937640Z","iopub.status.idle":"2022-08-02T05:12:57.296348Z","shell.execute_reply.started":"2022-08-02T05:12:53.937592Z","shell.execute_reply":"2022-08-02T05:12:57.295301Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.summary()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:57.300586Z","iopub.execute_input":"2022-08-02T05:12:57.303058Z","iopub.status.idle":"2022-08-02T05:12:57.312123Z","shell.execute_reply.started":"2022-08-02T05:12:57.303019Z","shell.execute_reply":"2022-08-02T05:12:57.311014Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Compiling our model**\n\n3 important things related to our model:-\n     \n     \n     * loss: we will set our loss as binary_crossentropy since we are attacking a binary classification problem\n     * optimizer: optimizers shape and mold our model into its most accurate possible form by futzing with the weights\n     * metrics: This is the evaluation criteria that we choose to evaluate our model","metadata":{}},{"cell_type":"code","source":"from tensorflow import keras\nfrom keras import optimizers\nmodel.compile(loss='binary_crossentropy',\n              optimizer=keras.optimizers.RMSprop(), \n              metrics=['acc'])","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:57.313540Z","iopub.execute_input":"2022-08-02T05:12:57.314092Z","iopub.status.idle":"2022-08-02T05:12:57.332798Z","shell.execute_reply.started":"2022-08-02T05:12:57.314056Z","shell.execute_reply":"2022-08-02T05:12:57.331886Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"epochs = 10\nhistory = model.fit_generator(train_generator, \n                              steps_per_epoch=100,\n                             epochs=10,\n                             validation_data=validation_generator,\n                             validation_steps=50)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:12:57.334152Z","iopub.execute_input":"2022-08-02T05:12:57.334704Z","iopub.status.idle":"2022-08-02T05:16:21.892643Z","shell.execute_reply.started":"2022-08-02T05:12:57.334664Z","shell.execute_reply":"2022-08-02T05:16:21.891692Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"acc = history.history['acc']\nepochs_=range(0,epochs)\nplt.plot(epochs_, acc, label='training accuracy')\nplt.xlabel('no of epochs')\nplt.ylabel('accuracy')\n\nacc_val = history.history['val_acc']\nplt.scatter(epochs_,acc_val,label=\"validation accuracy\")\nplt.title(\"no of epochs vs accuracy\")\nplt.legend()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:16:21.897139Z","iopub.execute_input":"2022-08-02T05:16:21.899358Z","iopub.status.idle":"2022-08-02T05:16:22.196218Z","shell.execute_reply.started":"2022-08-02T05:16:21.899318Z","shell.execute_reply":"2022-08-02T05:16:22.195366Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"acc = history.history['loss']\nepochs_=range(0,epochs)\nplt.plot(epochs_,acc,label='training loss')\nplt.xlabel('No of epochs')\nplt.ylabel('loss')\n\n\nacc_val = history.history['val_loss']\nplt.scatter(epochs_,acc_val,label=\"validation loss\")\nplt.title('no of epochs vs loss')\nplt.legend()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:16:22.200309Z","iopub.execute_input":"2022-08-02T05:16:22.202513Z","iopub.status.idle":"2022-08-02T05:16:22.451388Z","shell.execute_reply.started":"2022-08-02T05:16:22.202462Z","shell.execute_reply":"2022-08-02T05:16:22.450390Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Improving our model using VGG16**\n\n   * Instantiating the VGG16 convolution base","metadata":{}},{"cell_type":"code","source":"model_vg = VGG16(weights='imagenet', include_top=False)\nmodel_vg.summary()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:16:22.452653Z","iopub.execute_input":"2022-08-02T05:16:22.453575Z","iopub.status.idle":"2022-08-02T05:16:23.118228Z","shell.execute_reply.started":"2022-08-02T05:16:22.453539Z","shell.execute_reply":"2022-08-02T05:16:23.117170Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Extracting features using VGG16**","metadata":{}},{"cell_type":"code","source":"def extract_features(directory, samples,df):\n    \n    features = np.zeros(shape=(samples,4,4,512))\n    labels=np.zeros(shape=(samples))\n    generator=datagen.flow_from_dataframe(dataframe=df, \n                                          directory=directory,\n                                         x_col='id',\n                                         y_col='has_cactus',\n                                         class_mode='other',\n                                         batch_size=batch_size,\n                                         target_size=(150,150))\n    i=0\n    for input_batch, label_batch in generator:\n        feature_batch=model_vg.predict(input_batch)\n        features[i*batch_size:(i+1)*batch_size]=feature_batch\n        labels[i*batch_size:(i+1)*batch_size]=label_batch\n        i+=1\n        if(i*batch_size>samples):\n            break\n    return (features, labels)\n\ntrain.has_cactus = train.has_cactus.astype(int)\nfeatures, labels=extract_features(train_dir, 17500, train)\ntrain_features=features[:15001]\ntrain_labels=labels[:15001]\n\nvalidation_features=features[15000:]\nvalidation_labels=labels[15000:]","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:16:23.119802Z","iopub.execute_input":"2022-08-02T05:16:23.120196Z","iopub.status.idle":"2022-08-02T05:17:19.071674Z","shell.execute_reply.started":"2022-08-02T05:16:23.120137Z","shell.execute_reply":"2022-08-02T05:17:19.070662Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Reshaping our features to feed into our dense layers**","metadata":{}},{"cell_type":"code","source":"test_features, test_labels = extract_features(test_dir, \n                                              4000,\n                                             df_test)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:17:19.073170Z","iopub.execute_input":"2022-08-02T05:17:19.073557Z","iopub.status.idle":"2022-08-02T05:17:31.899224Z","shell.execute_reply.started":"2022-08-02T05:17:19.073518Z","shell.execute_reply":"2022-08-02T05:17:31.898275Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_features=train_features.reshape((15001,4*4*512))\nvalidation_features=validation_features.reshape((\n    2500,4*4*512))\n\ntest_features=test_features.reshape((4000,4*4*512))","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:17:31.900644Z","iopub.execute_input":"2022-08-02T05:17:31.901011Z","iopub.status.idle":"2022-08-02T05:17:31.908013Z","shell.execute_reply.started":"2022-08-02T05:17:31.900974Z","shell.execute_reply":"2022-08-02T05:17:31.906910Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Define a densely connected network**","metadata":{}},{"cell_type":"code","source":"model=models.Sequential()\nmodel.add(layers.Dense(212,activation='relu',\n                      kernel_regularizer=regularizers.l1_l2(.001),\n                      input_dim=(4*4*512)))\nmodel.add(layers.Dropout(0.2))\nmodel.add(layers.Dense(1,activation='sigmoid'))","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:21:32.225601Z","iopub.execute_input":"2022-08-02T05:21:32.226180Z","iopub.status.idle":"2022-08-02T05:21:32.257761Z","shell.execute_reply.started":"2022-08-02T05:21:32.226146Z","shell.execute_reply":"2022-08-02T05:21:32.256870Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.compile(loss='binary_crossentropy',\n              optimizer=keras.optimizers.RMSprop(), \n              metrics=['acc'])","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:21:34.507188Z","iopub.execute_input":"2022-08-02T05:21:34.507597Z","iopub.status.idle":"2022-08-02T05:21:34.519129Z","shell.execute_reply.started":"2022-08-02T05:21:34.507562Z","shell.execute_reply":"2022-08-02T05:21:34.518191Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"history = model.fit(train_features, train_labels, epochs=30,\n                   batch_size=15, validation_data=(\n                   validation_features,validation_labels))","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:21:35.571396Z","iopub.execute_input":"2022-08-02T05:21:35.572159Z","iopub.status.idle":"2022-08-02T05:23:59.222931Z","shell.execute_reply.started":"2022-08-02T05:21:35.572118Z","shell.execute_reply":"2022-08-02T05:23:59.221392Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_pre = model.predict(test_features)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:24:29.029929Z","iopub.execute_input":"2022-08-02T05:24:29.030351Z","iopub.status.idle":"2022-08-02T05:24:29.769567Z","shell.execute_reply.started":"2022-08-02T05:24:29.030316Z","shell.execute_reply":"2022-08-02T05:24:29.768193Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.DataFrame({'id':df_test['id']})\ndf['has_cactus'] = y_pre\ndf.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:24:32.819158Z","iopub.execute_input":"2022-08-02T05:24:32.819541Z","iopub.status.idle":"2022-08-02T05:24:32.833045Z","shell.execute_reply.started":"2022-08-02T05:24:32.819499Z","shell.execute_reply":"2022-08-02T05:24:32.831685Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['has_cactus'] = np.where(df['has_cactus']>0.5, 1, 0)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:26:38.625526Z","iopub.execute_input":"2022-08-02T05:26:38.625995Z","iopub.status.idle":"2022-08-02T05:26:38.633873Z","shell.execute_reply.started":"2022-08-02T05:26:38.625960Z","shell.execute_reply":"2022-08-02T05:26:38.632208Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:26:47.507205Z","iopub.execute_input":"2022-08-02T05:26:47.507689Z","iopub.status.idle":"2022-08-02T05:26:47.525357Z","shell.execute_reply.started":"2022-08-02T05:26:47.507646Z","shell.execute_reply":"2022-08-02T05:26:47.524539Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.to_csv(\"submission.csv\", index=False)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T05:26:55.605574Z","iopub.execute_input":"2022-08-02T05:26:55.605940Z","iopub.status.idle":"2022-08-02T05:26:55.620791Z","shell.execute_reply.started":"2022-08-02T05:26:55.605908Z","shell.execute_reply":"2022-08-02T05:26:55.619794Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}