{"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 numpy as np\nimport pandas as pd\nimport os\nimport cv2\nfrom zipfile import ZipFile\nimport matplotlib.pyplot as plt\nimport shutil\n\nimport warnings\nwarnings.filterwarnings('ignore')\n\nimport tensorflow as tf\nfrom tensorflow import keras\nfrom tensorflow.keras import layers","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:01:28.473979Z","iopub.execute_input":"2023-09-24T14:01:28.474820Z","iopub.status.idle":"2023-09-24T14:01:37.554694Z","shell.execute_reply.started":"2023-09-24T14:01:28.474776Z","shell.execute_reply":"2023-09-24T14:01:37.553626Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Unzip the data\n\n# Train data \nwith ZipFile(\"/kaggle/input/dogs-vs-cats/train.zip\", 'r') as f:\n    f.extractall()\n\n# Test data\nwith ZipFile(\"/kaggle/input/dogs-vs-cats/test1.zip\", 'r') as f:\n    f.extractall()","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:01:37.557649Z","iopub.execute_input":"2023-09-24T14:01:37.558405Z","iopub.status.idle":"2023-09-24T14:01:53.243183Z","shell.execute_reply.started":"2023-09-24T14:01:37.558368Z","shell.execute_reply":"2023-09-24T14:01:53.242174Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data_dir = \"/kaggle/working/train_data\"\ntest_dir = \"/kaggle/working/test1\"\n\nheight = 150\nwidth = 150\n\nseed = 39\nBATCH_SIZE = 8","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:01:53.244794Z","iopub.execute_input":"2023-09-24T14:01:53.245181Z","iopub.status.idle":"2023-09-24T14:01:53.250443Z","shell.execute_reply.started":"2023-09-24T14:01:53.245144Z","shell.execute_reply":"2023-09-24T14:01:53.249297Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"np.random.seed(seed)\ntf.random.set_seed(seed)","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:01:53.253156Z","iopub.execute_input":"2023-09-24T14:01:53.253753Z","iopub.status.idle":"2023-09-24T14:01:53.947582Z","shell.execute_reply.started":"2023-09-24T14:01:53.253720Z","shell.execute_reply":"2023-09-24T14:01:53.946196Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for image_name in os.listdir(\"/kaggle/working/train\"):\n    src = os.path.join(\"/kaggle/working/train\", image_name)\n    \n    label = image_name.split(\".\")[0]\n    if label == 'cat':\n        dest = os.path.join(data_dir, 'cat')\n    else:\n        dest = os.path.join(data_dir, 'dog')\n        \n    if os.path.exists(dest) is False:\n        os.makedirs(dest)\n    \n    shutil.move(src, dest)\n    \n","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:01:53.949261Z","iopub.execute_input":"2023-09-24T14:01:53.949650Z","iopub.status.idle":"2023-09-24T14:01:55.496968Z","shell.execute_reply.started":"2023-09-24T14:01:53.949614Z","shell.execute_reply":"2023-09-24T14:01:55.495960Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"os.mkdir(\"/kaggle/working/saved_models/\")","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:01:55.498302Z","iopub.execute_input":"2023-09-24T14:01:55.498738Z","iopub.status.idle":"2023-09-24T14:01:55.504777Z","shell.execute_reply.started":"2023-09-24T14:01:55.498702Z","shell.execute_reply":"2023-09-24T14:01:55.503813Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Visualizing image \n\nimage = cv2.imread(data_dir + \"/dog\"+ \"/dog.4465.jpg\", cv2.IMREAD_COLOR)\nimage = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)\nplt.imshow(image)\nplt.axis(False)\nplt.show()\n","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:01:55.506225Z","iopub.execute_input":"2023-09-24T14:01:55.507281Z","iopub.status.idle":"2023-09-24T14:01:55.738589Z","shell.execute_reply.started":"2023-09-24T14:01:55.507246Z","shell.execute_reply":"2023-09-24T14:01:55.737660Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"image = cv2.imread(test_dir + \"/4194.jpg\", cv2.IMREAD_COLOR)\nimage = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)\nplt.imshow(image)\nplt.axis(False)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:01:55.739654Z","iopub.execute_input":"2023-09-24T14:01:55.740008Z","iopub.status.idle":"2023-09-24T14:01:55.936554Z","shell.execute_reply.started":"2023-09-24T14:01:55.739973Z","shell.execute_reply":"2023-09-24T14:01:55.935671Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data = tf.keras.utils.image_dataset_from_directory(data_dir,\n                                                      labels=\"inferred\", \n                                                      label_mode=\"int\",\n                                                      class_names=['cat', 'dog'],\n                                                      color_mode='rgb', \n                                                      batch_size=BATCH_SIZE, \n                                                      image_size=(height, width), \n                                                      shuffle=True, \n                                                      seed=seed,\n                                                      validation_split=0.15,\n                                                      subset='training')\n\nvalid_test_data = tf.keras.utils.image_dataset_from_directory(data_dir,\n                                                             labels=\"inferred\",\n                                                             label_mode=\"int\",\n                                                             class_names=['cat', 'dog'],\n                                                             color_mode='rgb',\n                                                             batch_size=BATCH_SIZE,\n                                                             image_size=(height, width),\n                                                             shuffle=True,\n                                                             seed=seed,\n                                                             validation_split=0.15,\n                                                             subset=\"validation\")","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:01:55.937960Z","iopub.execute_input":"2023-09-24T14:01:55.938736Z","iopub.status.idle":"2023-09-24T14:02:03.523328Z","shell.execute_reply.started":"2023-09-24T14:01:55.938702Z","shell.execute_reply":"2023-09-24T14:02:03.521390Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"The cardinality of train data is: \", tf.data.experimental.cardinality(train_data).numpy())\nprint(\"The cardinality of test+valid data is: \", tf.data.experimental.cardinality(valid_test_data).numpy())","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:02:03.528940Z","iopub.execute_input":"2023-09-24T14:02:03.529347Z","iopub.status.idle":"2023-09-24T14:02:03.537974Z","shell.execute_reply.started":"2023-09-24T14:02:03.529312Z","shell.execute_reply":"2023-09-24T14:02:03.536797Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Splitting the data into valid and test \n\nvalid_data = valid_test_data.take(int(0.5 * tf.data.experimental.cardinality(valid_test_data).numpy()))\ntest_data = valid_test_data.skip(int(0.5 * tf.data.experimental.cardinality(valid_test_data).numpy()))\n","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:02:03.539190Z","iopub.execute_input":"2023-09-24T14:02:03.539567Z","iopub.status.idle":"2023-09-24T14:02:03.555151Z","shell.execute_reply.started":"2023-09-24T14:02:03.539530Z","shell.execute_reply":"2023-09-24T14:02:03.554168Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"The cardinality of train data is: \", tf.data.experimental.cardinality(train_data).numpy())\nprint(\"The cardinality of validation data is: \", tf.data.experimental.cardinality(valid_data).numpy())\nprint(\"The cardinality of test data is: \", tf.data.experimental.cardinality(test_data).numpy())","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:02:03.557611Z","iopub.execute_input":"2023-09-24T14:02:03.557895Z","iopub.status.idle":"2023-09-24T14:02:03.570009Z","shell.execute_reply.started":"2023-09-24T14:02:03.557871Z","shell.execute_reply":"2023-09-24T14:02:03.568914Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def rescaling_data(images, labels):\n    return images / 255.0, labels","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:02:03.571272Z","iopub.execute_input":"2023-09-24T14:02:03.571669Z","iopub.status.idle":"2023-09-24T14:02:03.578601Z","shell.execute_reply.started":"2023-09-24T14:02:03.571642Z","shell.execute_reply":"2023-09-24T14:02:03.577550Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data = train_data.map(rescaling_data)\nvalid_data = valid_data.map(rescaling_data)\ntest_data = test_data.map(rescaling_data)","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:02:03.579737Z","iopub.execute_input":"2023-09-24T14:02:03.580066Z","iopub.status.idle":"2023-09-24T14:02:03.648034Z","shell.execute_reply.started":"2023-09-24T14:02:03.580037Z","shell.execute_reply":"2023-09-24T14:02:03.647073Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data_augmentation = keras.models.Sequential([\n    layers.RandomBrightness(0.2, value_range=(0, 1)),\n    layers.RandomContrast(0.2),\n    layers.RandomFlip(\"horizontal\"),\n    layers.RandomZoom(0.1, 0.1)\n])","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:02:03.649415Z","iopub.execute_input":"2023-09-24T14:02:03.649724Z","iopub.status.idle":"2023-09-24T14:02:03.674019Z","shell.execute_reply.started":"2023-09-24T14:02:03.649692Z","shell.execute_reply":"2023-09-24T14:02:03.673073Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data = train_data.prefetch(tf.data.AUTOTUNE).cache()","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:02:03.675035Z","iopub.execute_input":"2023-09-24T14:02:03.675364Z","iopub.status.idle":"2023-09-24T14:02:03.686500Z","shell.execute_reply.started":"2023-09-24T14:02:03.675333Z","shell.execute_reply":"2023-09-24T14:02:03.685461Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"inp = layers.Input((height, width, 3))\nx = data_augmentation(inp)\nx = layers.Conv2D(32, (7, 7), 1, \"same\", kernel_initializer=\"he_normal\", use_bias=False) (x)\nx = layers.BatchNormalization(axis=-1) (x)\nx = layers.Activation(\"LeakyReLU\") (x)\nx = layers.MaxPooling2D(2, 2) (x)\nx = layers.Conv2D(64, (3, 3), 1, \"same\", kernel_initializer=\"he_normal\", use_bias=False) (x)\nx = layers.BatchNormalization(axis=-1) (x)\nx = layers.Activation(\"LeakyReLU\") (x)\nx = layers.MaxPooling2D(2, 2) (x)\nx = layers.Conv2D(128, (3, 3), 1, \"same\", kernel_initializer=\"he_normal\", use_bias=False) (x)\nx = layers.BatchNormalization(axis=-1) (x)\nx = layers.Activation(\"LeakyReLU\") (x)\nx = layers.MaxPooling2D(2, 2) (x)\nx = layers.Conv2D(128, (3, 3), 1, \"same\", kernel_initializer=\"he_normal\", use_bias=False) (x)\nx = layers.BatchNormalization(axis=-1) (x)\nx = layers.Activation(\"LeakyReLU\") (x)\nx = layers.MaxPooling2D(2, 2) (x)\nx = layers.Conv2D(128, (3, 3), 1, \"same\", kernel_initializer=\"he_normal\", use_bias=False) (x)\nx = layers.BatchNormalization(axis=-1) (x)\nx = layers.Activation(\"LeakyReLU\") (x)\nx = layers.MaxPooling2D(2, 2) (x)\nx = layers.Flatten() (x)\nx = layers.Dropout(0.4) (x)\nx = layers.Dense(512, activation=\"LeakyReLU\") (x)\nx = layers.Dropout(0.4) (x)\nout = layers.Dense(1, activation=\"sigmoid\") (x)\n\n\nmodel = keras.models.Model(inp, out)\nmodel.summary()\n","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:02:03.687848Z","iopub.execute_input":"2023-09-24T14:02:03.688328Z","iopub.status.idle":"2023-09-24T14:02:04.296453Z","shell.execute_reply.started":"2023-09-24T14:02:03.688296Z","shell.execute_reply":"2023-09-24T14:02:04.295579Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.compile(optimizer=\"adam\",\n             loss=\"binary_crossentropy\",\n             metrics=\"accuracy\")\n\ncallbacks = [\n    keras.callbacks.ModelCheckpoint(\n        \"/kaggle/working/saved_models\",\n        monitor='val_loss',\n        save_best_model=True),\n    keras.callbacks.ReduceLROnPlateau(\n        monitor='val_loss',\n        factor=0.5,\n        patience=3,\n        verbose=1)\n]","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:02:04.297601Z","iopub.execute_input":"2023-09-24T14:02:04.297987Z","iopub.status.idle":"2023-09-24T14:02:04.340155Z","shell.execute_reply.started":"2023-09-24T14:02:04.297943Z","shell.execute_reply":"2023-09-24T14:02:04.339199Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"history = model.fit(\n    train_data,\n    epochs=30,\n    verbose=1,\n    shuffle=True,\n    callbacks=callbacks,\n    validation_data=valid_data\n)","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:02:04.341871Z","iopub.execute_input":"2023-09-24T14:02:04.342233Z","iopub.status.idle":"2023-09-24T14:33:35.308015Z","shell.execute_reply.started":"2023-09-24T14:02:04.342199Z","shell.execute_reply":"2023-09-24T14:33:35.306946Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"hello world\")","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:33:35.312001Z","iopub.execute_input":"2023-09-24T14:33:35.312321Z","iopub.status.idle":"2023-09-24T14:33:35.317460Z","shell.execute_reply.started":"2023-09-24T14:33:35.312293Z","shell.execute_reply":"2023-09-24T14:33:35.316515Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def visualize_result(data, model, n):\n    shuffled_data = data.unbatch().shuffle(buffer_size=len(data))\n    taken_data = shuffled_data.take(n)\n    sample_data = list(iter(taken_data))\n    predictions = model.predict(taken_data.batch(n), verbose=0)\n\n    n_rows = 2\n    n_cols = n // 2\n    fig, ax = plt.subplots(n_rows, n_cols)\n\n    for row in range(n_rows):\n        for col in range(n_cols):\n            image = np.array(sample_data[row*n_cols+col][0])\n            label = sample_data[row*n_cols+col][1].numpy()\n            pred_proba = predictions[row*n_cols+col][0]\n            pred = tf.round(pred_proba).numpy()\n            ax[row, col].imshow(image)\n            ax[row, col].set_title(\n                f\"prediction: cat\\nconfidence: {1-pred_proba : .2f}\" if pred == 0 \n                    else f\"prediction: dog\\nconfidence: {pred_proba : .2f}\",\n                c='green' if label == pred else 'red'\n                )\n            ax[row, col].axis(False)\n\n    fig.tight_layout()\n    plt.show()","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:33:35.319108Z","iopub.execute_input":"2023-09-24T14:33:35.319781Z","iopub.status.idle":"2023-09-24T14:33:35.335413Z","shell.execute_reply.started":"2023-09-24T14:33:35.319747Z","shell.execute_reply":"2023-09-24T14:33:35.334454Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"visualize_result(valid_data, model, 8)","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:33:35.337236Z","iopub.execute_input":"2023-09-24T14:33:35.337963Z","iopub.status.idle":"2023-09-24T14:33:37.405974Z","shell.execute_reply.started":"2023-09-24T14:33:35.337928Z","shell.execute_reply":"2023-09-24T14:33:37.405057Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.evaluate(valid_data)","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:33:37.408070Z","iopub.execute_input":"2023-09-24T14:33:37.408776Z","iopub.status.idle":"2023-09-24T14:33:39.967216Z","shell.execute_reply.started":"2023-09-24T14:33:37.408739Z","shell.execute_reply":"2023-09-24T14:33:39.966146Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.evaluate(test_data)","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:33:39.969059Z","iopub.execute_input":"2023-09-24T14:33:39.969477Z","iopub.status.idle":"2023-09-24T14:33:45.112523Z","shell.execute_reply.started":"2023-09-24T14:33:39.969439Z","shell.execute_reply":"2023-09-24T14:33:45.111353Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"images_list = []\nlabels_list = []\n\n# Iterate through the dataset and collect images and labels\nfor image, label in test_data.unbatch():\n    images_list.append(image.numpy())\n    labels_list.append(label.numpy())\n\n# Convert the lists to NumPy arrays\nimages_array = np.array(images_list)\nlabels_array = np.array(labels_list)","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:35:24.979809Z","iopub.execute_input":"2023-09-24T14:35:24.980314Z","iopub.status.idle":"2023-09-24T14:35:30.364700Z","shell.execute_reply.started":"2023-09-24T14:35:24.980269Z","shell.execute_reply":"2023-09-24T14:35:30.363578Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predictions = np.int0(model.predict(images_array) > 0.5).reshape(-1)\npredictions","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:35:52.767657Z","iopub.execute_input":"2023-09-24T14:35:52.769070Z","iopub.status.idle":"2023-09-24T14:35:55.041699Z","shell.execute_reply.started":"2023-09-24T14:35:52.769022Z","shell.execute_reply":"2023-09-24T14:35:55.040473Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"actual = labels_array\nactual","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:35:56.082958Z","iopub.execute_input":"2023-09-24T14:35:56.083340Z","iopub.status.idle":"2023-09-24T14:35:56.090102Z","shell.execute_reply.started":"2023-09-24T14:35:56.083309Z","shell.execute_reply":"2023-09-24T14:35:56.089141Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"map_accuracy = (predictions == actual).reshape(-1, 1)\nimport seaborn as sns\n\nsns.heatmap(map_accuracy, cmap='binary')","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:36:07.070225Z","iopub.execute_input":"2023-09-24T14:36:07.070671Z","iopub.status.idle":"2023-09-24T14:36:08.318065Z","shell.execute_reply.started":"2023-09-24T14:36:07.070624Z","shell.execute_reply":"2023-09-24T14:36:08.317070Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"map_accuracy.sum()","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:36:13.313261Z","iopub.execute_input":"2023-09-24T14:36:13.314106Z","iopub.status.idle":"2023-09-24T14:36:13.322042Z","shell.execute_reply.started":"2023-09-24T14:36:13.314060Z","shell.execute_reply":"2023-09-24T14:36:13.320908Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"(~map_accuracy).sum()","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:36:32.695927Z","iopub.execute_input":"2023-09-24T14:36:32.696310Z","iopub.status.idle":"2023-09-24T14:36:32.704066Z","shell.execute_reply.started":"2023-09-24T14:36:32.696279Z","shell.execute_reply":"2023-09-24T14:36:32.703140Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(map_accuracy)","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:36:36.314092Z","iopub.execute_input":"2023-09-24T14:36:36.314886Z","iopub.status.idle":"2023-09-24T14:36:36.320935Z","shell.execute_reply.started":"2023-09-24T14:36:36.314843Z","shell.execute_reply":"2023-09-24T14:36:36.320009Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission_data = pd.DataFrame({\"filename\" : os.listdir(test_dir)})\nsubmission_data['label'] = \"unknown\"\nsubmission_data.head()","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:36:49.780980Z","iopub.execute_input":"2023-09-24T14:36:49.781377Z","iopub.status.idle":"2023-09-24T14:36:49.818808Z","shell.execute_reply.started":"2023-09-24T14:36:49.781346Z","shell.execute_reply":"2023-09-24T14:36:49.817612Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission_test_data = tf.keras.utils.image_dataset_from_directory(test_dir,\n                                                             labels=None,\n                                                             color_mode='rgb',\n                                                             image_size=(height, width),\n                                                             shuffle=False)","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:43:18.278233Z","iopub.execute_input":"2023-09-24T14:43:18.278616Z","iopub.status.idle":"2023-09-24T14:43:18.885464Z","shell.execute_reply.started":"2023-09-24T14:43:18.278586Z","shell.execute_reply":"2023-09-24T14:43:18.884303Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predictions = model.predict(submission_test_data)\npredictions","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:43:22.864539Z","iopub.execute_input":"2023-09-24T14:43:22.864900Z","iopub.status.idle":"2023-09-24T14:43:38.975258Z","shell.execute_reply.started":"2023-09-24T14:43:22.864869Z","shell.execute_reply":"2023-09-24T14:43:38.974134Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission_data['label'] = np.int0(predictions)","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:44:55.910927Z","iopub.execute_input":"2023-09-24T14:44:55.911312Z","iopub.status.idle":"2023-09-24T14:44:55.916782Z","shell.execute_reply.started":"2023-09-24T14:44:55.911280Z","shell.execute_reply":"2023-09-24T14:44:55.915691Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission_data.head()","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:44:57.076599Z","iopub.execute_input":"2023-09-24T14:44:57.076980Z","iopub.status.idle":"2023-09-24T14:44:57.087309Z","shell.execute_reply.started":"2023-09-24T14:44:57.076946Z","shell.execute_reply":"2023-09-24T14:44:57.086182Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission_data.to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2023-09-24T14:46:16.509413Z","iopub.execute_input":"2023-09-24T14:46:16.509802Z","iopub.status.idle":"2023-09-24T14:46:16.551262Z","shell.execute_reply.started":"2023-09-24T14:46:16.509771Z","shell.execute_reply":"2023-09-24T14:46:16.550344Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}