{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"gpu","dataSources":[{"sourceId":3004,"databundleVersionId":861823,"sourceType":"competition"}],"dockerImageVersionId":30527,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"## Mount Drive","metadata":{"id":"qHQuMV6VWYru"}},{"cell_type":"code","source":"# from google.colab import drive\n# drive.mount(\"/content/drive\")","metadata":{"id":"zt98eHYUWV-2","execution":{"iopub.status.busy":"2024-04-10T05:42:48.761986Z","iopub.execute_input":"2024-04-10T05:42:48.762234Z","iopub.status.idle":"2024-04-10T05:42:48.769001Z","shell.execute_reply.started":"2024-04-10T05:42:48.762211Z","shell.execute_reply":"2024-04-10T05:42:48.768138Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Importing Packages","metadata":{"id":"Ud6hFF4rnhQK"}},{"cell_type":"code","source":"# Fetching Dataset\n# from sklearn.datasets import fetch_openml\n\n# Processing Data\nimport numpy as np, pandas as pd\n\n# Scaling Features\nfrom sklearn.preprocessing import MinMaxScaler\n\n# Binarizing Output\nfrom sklearn.preprocessing import LabelBinarizer\n\n# Spliting Train & Test Set\nfrom sklearn.model_selection import train_test_split\nimport matplotlib.pyplot as plt\n\n# Image Augmentation\nfrom tensorflow.keras.preprocessing.image import ImageDataGenerator\n\n# Creating and Training a CNN Model\nfrom tensorflow.keras import layers,models\nfrom tensorflow.keras.callbacks import EarlyStopping","metadata":{"id":"RfU8VXwvngn0","execution":{"iopub.status.busy":"2024-04-10T05:42:48.773148Z","iopub.execute_input":"2024-04-10T05:42:48.773453Z","iopub.status.idle":"2024-04-10T05:42:57.339593Z","shell.execute_reply.started":"2024-04-10T05:42:48.773430Z","shell.execute_reply":"2024-04-10T05:42:57.338738Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Fetching Dataset","metadata":{"id":"DOoaGBDk-FU_"}},{"cell_type":"code","source":"# X, y = fetch_openml(\"mnist_784\", version = 1, return_X_y = True, as_frame = False)\ndataset_dir = \"/kaggle/input/digit-recognizer/\"\ndataset_train = pd.read_csv(dataset_dir + \"train.csv\")\ndataset_test = pd.read_csv(dataset_dir + \"test.csv\")\ndataset_submission = pd.read_csv(dataset_dir + \"sample_submission.csv\")","metadata":{"id":"_bPX1QuDWDmS","execution":{"iopub.status.busy":"2024-04-10T05:42:57.341579Z","iopub.execute_input":"2024-04-10T05:42:57.342337Z","iopub.status.idle":"2024-04-10T05:43:03.652708Z","shell.execute_reply.started":"2024-04-10T05:42:57.342300Z","shell.execute_reply":"2024-04-10T05:43:03.651891Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset_train","metadata":{"execution":{"iopub.status.busy":"2024-04-10T05:43:03.653932Z","iopub.execute_input":"2024-04-10T05:43:03.654253Z","iopub.status.idle":"2024-04-10T05:43:03.682325Z","shell.execute_reply.started":"2024-04-10T05:43:03.654215Z","shell.execute_reply":"2024-04-10T05:43:03.681501Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset_test","metadata":{"execution":{"iopub.status.busy":"2024-04-10T05:43:03.685238Z","iopub.execute_input":"2024-04-10T05:43:03.685579Z","iopub.status.idle":"2024-04-10T05:43:03.706103Z","shell.execute_reply.started":"2024-04-10T05:43:03.685554Z","shell.execute_reply":"2024-04-10T05:43:03.705254Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train = dataset_train.iloc[:, 1:]\ny_train = dataset_train.iloc[:, 0]\nX_test = dataset_test.iloc[:, :]","metadata":{"execution":{"iopub.status.busy":"2024-04-10T05:43:03.707103Z","iopub.execute_input":"2024-04-10T05:43:03.707361Z","iopub.status.idle":"2024-04-10T05:43:03.711886Z","shell.execute_reply.started":"2024-04-10T05:43:03.707339Z","shell.execute_reply":"2024-04-10T05:43:03.710987Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(X_train.shape)\nprint(y_train.shape)\nprint(X_test.shape)","metadata":{"execution":{"iopub.status.busy":"2024-04-10T05:43:03.713027Z","iopub.execute_input":"2024-04-10T05:43:03.713302Z","iopub.status.idle":"2024-04-10T05:43:03.721439Z","shell.execute_reply.started":"2024-04-10T05:43:03.713277Z","shell.execute_reply":"2024-04-10T05:43:03.720456Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train","metadata":{"id":"SOXiTmPe5MVM","executionInfo":{"status":"ok","timestamp":1671821741250,"user_tz":-360,"elapsed":44,"user":{"displayName":"1578_Avishek Chowdhury","userId":"14734427622886483691"}},"outputId":"cf13a105-3a71-4e1e-b361-68aff6ce196f","execution":{"iopub.status.busy":"2024-04-10T05:43:03.722590Z","iopub.execute_input":"2024-04-10T05:43:03.722869Z","iopub.status.idle":"2024-04-10T05:43:03.749232Z","shell.execute_reply.started":"2024-04-10T05:43:03.722822Z","shell.execute_reply":"2024-04-10T05:43:03.748329Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_train","metadata":{"id":"fzUK43Es5SO6","executionInfo":{"status":"ok","timestamp":1671821741251,"user_tz":-360,"elapsed":33,"user":{"displayName":"1578_Avishek Chowdhury","userId":"14734427622886483691"}},"outputId":"2194b928-ab4d-4664-a8e6-ed7e916fc246","execution":{"iopub.status.busy":"2024-04-10T05:43:03.750491Z","iopub.execute_input":"2024-04-10T05:43:03.750752Z","iopub.status.idle":"2024-04-10T05:43:03.758929Z","shell.execute_reply.started":"2024-04-10T05:43:03.750728Z","shell.execute_reply":"2024-04-10T05:43:03.758033Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# X_test","metadata":{"execution":{"iopub.status.busy":"2024-04-10T05:43:03.760032Z","iopub.execute_input":"2024-04-10T05:43:03.760288Z","iopub.status.idle":"2024-04-10T05:43:03.766305Z","shell.execute_reply.started":"2024-04-10T05:43:03.760266Z","shell.execute_reply":"2024-04-10T05:43:03.765589Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Scaling Features","metadata":{"id":"VhtYg63_32mi"}},{"cell_type":"code","source":"sc = MinMaxScaler()\nX_train = sc.fit_transform(X_train)\nX_test = sc.fit_transform(X_test)","metadata":{"id":"2HSHvUQx3pVm","execution":{"iopub.status.busy":"2024-04-10T05:43:03.769693Z","iopub.execute_input":"2024-04-10T05:43:03.769973Z","iopub.status.idle":"2024-04-10T05:43:04.303690Z","shell.execute_reply.started":"2024-04-10T05:43:03.769950Z","shell.execute_reply":"2024-04-10T05:43:04.302893Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train","metadata":{"id":"jSj6M9SO5W1m","executionInfo":{"status":"ok","timestamp":1671821741254,"user_tz":-360,"elapsed":19,"user":{"displayName":"1578_Avishek Chowdhury","userId":"14734427622886483691"}},"outputId":"513734c6-8342-47ed-bb2d-62fa5ff9591b","execution":{"iopub.status.busy":"2024-04-10T05:43:04.304707Z","iopub.execute_input":"2024-04-10T05:43:04.304999Z","iopub.status.idle":"2024-04-10T05:43:04.311583Z","shell.execute_reply.started":"2024-04-10T05:43:04.304973Z","shell.execute_reply":"2024-04-10T05:43:04.310620Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# X_test","metadata":{"execution":{"iopub.status.busy":"2024-04-10T05:43:04.312978Z","iopub.execute_input":"2024-04-10T05:43:04.313308Z","iopub.status.idle":"2024-04-10T05:43:04.319744Z","shell.execute_reply.started":"2024-04-10T05:43:04.313281Z","shell.execute_reply":"2024-04-10T05:43:04.318835Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Binarizing Output","metadata":{"id":"yZr22WSb4Kb8"}},{"cell_type":"code","source":"lb = LabelBinarizer()\ny_train = lb.fit_transform(y_train)\ny_train.shape","metadata":{"id":"vJsFgQUSK8wL","execution":{"iopub.status.busy":"2024-04-10T05:43:04.321090Z","iopub.execute_input":"2024-04-10T05:43:04.321391Z","iopub.status.idle":"2024-04-10T05:43:04.344397Z","shell.execute_reply.started":"2024-04-10T05:43:04.321367Z","shell.execute_reply":"2024-04-10T05:43:04.343572Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Spliting Train & Test Set\n","metadata":{"id":"W_9dK6Iw5EXZ"}},{"cell_type":"code","source":"X_train, X_val, y_train, y_val = train_test_split(X_train, y_train, train_size = 0.8, random_state = 45)","metadata":{"id":"ARtvOrWsWImO","execution":{"iopub.status.busy":"2024-04-10T05:43:04.345342Z","iopub.execute_input":"2024-04-10T05:43:04.345608Z","iopub.status.idle":"2024-04-10T05:43:04.718596Z","shell.execute_reply.started":"2024-04-10T05:43:04.345585Z","shell.execute_reply":"2024-04-10T05:43:04.717800Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(X_train.shape, X_val.shape, y_train.shape, y_val.shape)","metadata":{"id":"zUaoqtZC8LW5","executionInfo":{"status":"ok","timestamp":1671821742973,"user_tz":-360,"elapsed":57,"user":{"displayName":"1578_Avishek Chowdhury","userId":"14734427622886483691"}},"outputId":"2e17883d-0258-4a47-d1ff-211074b6717d","execution":{"iopub.status.busy":"2024-04-10T05:43:04.719775Z","iopub.execute_input":"2024-04-10T05:43:04.720410Z","iopub.status.idle":"2024-04-10T05:43:04.725746Z","shell.execute_reply.started":"2024-04-10T05:43:04.720374Z","shell.execute_reply":"2024-04-10T05:43:04.724857Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train = X_train.reshape(-1, 28, 28, 1)\nX_train.shape","metadata":{"id":"qydb7AVI_s4C","executionInfo":{"status":"ok","timestamp":1671821742975,"user_tz":-360,"elapsed":49,"user":{"displayName":"1578_Avishek Chowdhury","userId":"14734427622886483691"}},"outputId":"821d2196-37e7-41aa-f1b1-a14dcd257187","execution":{"iopub.status.busy":"2024-04-10T05:43:04.727023Z","iopub.execute_input":"2024-04-10T05:43:04.727382Z","iopub.status.idle":"2024-04-10T05:43:04.736347Z","shell.execute_reply.started":"2024-04-10T05:43:04.727350Z","shell.execute_reply":"2024-04-10T05:43:04.735503Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_val = X_val.reshape(-1, 28, 28, 1)\nX_val.shape","metadata":{"id":"RyXlO3S3_2uA","executionInfo":{"status":"ok","timestamp":1671821742975,"user_tz":-360,"elapsed":40,"user":{"displayName":"1578_Avishek Chowdhury","userId":"14734427622886483691"}},"outputId":"a3a9925d-cafe-4379-8774-037816e01ce1","execution":{"iopub.status.busy":"2024-04-10T05:43:04.737776Z","iopub.execute_input":"2024-04-10T05:43:04.738045Z","iopub.status.idle":"2024-04-10T05:43:04.747736Z","shell.execute_reply.started":"2024-04-10T05:43:04.738023Z","shell.execute_reply":"2024-04-10T05:43:04.746879Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test = X_test.reshape(-1, 28, 28, 1)\nX_test.shape","metadata":{"execution":{"iopub.status.busy":"2024-04-10T05:43:04.748796Z","iopub.execute_input":"2024-04-10T05:43:04.750896Z","iopub.status.idle":"2024-04-10T05:43:04.756530Z","shell.execute_reply.started":"2024-04-10T05:43:04.750864Z","shell.execute_reply":"2024-04-10T05:43:04.755647Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.imshow(X_train[0], cmap = \"gray\")","metadata":{"execution":{"iopub.status.busy":"2024-04-10T05:43:04.757644Z","iopub.execute_input":"2024-04-10T05:43:04.757920Z","iopub.status.idle":"2024-04-10T05:43:05.241291Z","shell.execute_reply.started":"2024-04-10T05:43:04.757897Z","shell.execute_reply":"2024-04-10T05:43:05.240256Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Image Augmentation\n","metadata":{}},{"cell_type":"code","source":"# Define ImageDataGenerator\ndatagen = ImageDataGenerator(\n    rotation_range = 30,\n    zoom_range = 0.4,\n    shear_range = 0.5,\n    cval = 0.0,\n    fill_mode = 'constant')","metadata":{"execution":{"iopub.status.busy":"2024-04-10T05:43:05.242388Z","iopub.execute_input":"2024-04-10T05:43:05.242678Z","iopub.status.idle":"2024-04-10T05:43:05.247514Z","shell.execute_reply.started":"2024-04-10T05:43:05.242653Z","shell.execute_reply":"2024-04-10T05:43:05.246554Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Generate augmented data\nbatch_size = 32\ntrain_generator = datagen.flow(X_train, y_train, batch_size = batch_size, shuffle = False)","metadata":{"execution":{"iopub.status.busy":"2024-04-10T05:43:05.248666Z","iopub.execute_input":"2024-04-10T05:43:05.248996Z","iopub.status.idle":"2024-04-10T05:43:05.298805Z","shell.execute_reply.started":"2024-04-10T05:43:05.248961Z","shell.execute_reply":"2024-04-10T05:43:05.297812Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(train_generator)","metadata":{"execution":{"iopub.status.busy":"2024-04-10T05:43:05.299938Z","iopub.execute_input":"2024-04-10T05:43:05.300207Z","iopub.status.idle":"2024-04-10T05:43:05.305918Z","shell.execute_reply.started":"2024-04-10T05:43:05.300185Z","shell.execute_reply":"2024-04-10T05:43:05.304995Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Creating and Training a CNN Model\n","metadata":{"id":"hW66EaXA4vnR"}},{"cell_type":"code","source":"cnn_model = models.Sequential([\n    layers.Conv2D(filters = 32, kernel_size = (3, 3), activation = 'relu', input_shape = (28, 28, 1)),\n    layers.MaxPooling2D((2, 2)),\n    \n    layers.Conv2D(filters = 64, kernel_size = (3, 3), activation = 'relu'),\n    layers.MaxPooling2D((2, 2)),\n\n    # layers.Conv2D(filters = 64, kernel_size = (3, 3), activation = 'relu'),\n    # layers.MaxPooling2D((2, 2)),\n    \n    layers.Flatten(),\n    layers.Dense(units = 64, activation = 'relu'),\n    layers.Dropout(rate = 0.5),\n    layers.Dense(units = 10, activation = 'softmax')\n])","metadata":{"id":"4_diEvVc_-HH","execution":{"iopub.status.busy":"2024-04-10T05:43:05.307115Z","iopub.execute_input":"2024-04-10T05:43:05.307394Z","iopub.status.idle":"2024-04-10T05:43:07.701012Z","shell.execute_reply.started":"2024-04-10T05:43:05.307371Z","shell.execute_reply":"2024-04-10T05:43:07.700219Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cnn_model.summary()","metadata":{"id":"ATyz_NHT0GBM","executionInfo":{"status":"ok","timestamp":1671821742979,"user_tz":-360,"elapsed":34,"user":{"displayName":"1578_Avishek Chowdhury","userId":"14734427622886483691"}},"outputId":"35e43b94-4261-45f9-f030-d9567dbac002","execution":{"iopub.status.busy":"2024-04-10T05:43:07.702042Z","iopub.execute_input":"2024-04-10T05:43:07.702308Z","iopub.status.idle":"2024-04-10T05:43:07.729970Z","shell.execute_reply.started":"2024-04-10T05:43:07.702284Z","shell.execute_reply":"2024-04-10T05:43:07.729115Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"n_epoch = 100\nacc_callback = EarlyStopping(monitor = 'val_accuracy', verbose = 1, patience = 15, mode = 'max', restore_best_weights = True, start_from_epoch = 30)\nloss_callback = EarlyStopping(monitor = 'val_loss', verbose = 1, patience = 15, mode = 'min', restore_best_weights = True, start_from_epoch = 30)","metadata":{"execution":{"iopub.status.busy":"2024-04-10T05:43:07.731034Z","iopub.execute_input":"2024-04-10T05:43:07.731292Z","iopub.status.idle":"2024-04-10T05:43:07.736591Z","shell.execute_reply.started":"2024-04-10T05:43:07.731262Z","shell.execute_reply":"2024-04-10T05:43:07.735696Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cnn_model.compile(loss = 'categorical_crossentropy', optimizer = 'adam', metrics = ['accuracy'])","metadata":{"id":"KyFKGexVET4M","execution":{"iopub.status.busy":"2024-04-10T05:43:07.737759Z","iopub.execute_input":"2024-04-10T05:43:07.738089Z","iopub.status.idle":"2024-04-10T05:43:07.757908Z","shell.execute_reply.started":"2024-04-10T05:43:07.738065Z","shell.execute_reply":"2024-04-10T05:43:07.757206Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"hist = cnn_model.fit(train_generator, validation_data = (X_val, y_val), epochs = n_epoch, callbacks = [acc_callback, loss_callback])","metadata":{"id":"358VdnTrAD0A","executionInfo":{"status":"ok","timestamp":1671822041071,"user_tz":-360,"elapsed":298109,"user":{"displayName":"1578_Avishek Chowdhury","userId":"14734427622886483691"}},"outputId":"de3f648c-e3bc-4086-d485-b75379f07f5e","execution":{"iopub.status.busy":"2024-04-10T05:43:07.758892Z","iopub.execute_input":"2024-04-10T05:43:07.759143Z","iopub.status.idle":"2024-04-10T05:53:02.555462Z","shell.execute_reply.started":"2024-04-10T05:43:07.759121Z","shell.execute_reply":"2024-04-10T05:53:02.554497Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"history_test = cnn_model.evaluate(X_val, y_val)","metadata":{"id":"XejIje1UAHZK","executionInfo":{"status":"ok","timestamp":1671822045807,"user_tz":-360,"elapsed":4769,"user":{"displayName":"1578_Avishek Chowdhury","userId":"14734427622886483691"}},"outputId":"c8a1acfe-b72d-49fb-8e6b-564a7b8ff1d3","execution":{"iopub.status.busy":"2024-04-10T05:53:02.561083Z","iopub.execute_input":"2024-04-10T05:53:02.561437Z","iopub.status.idle":"2024-04-10T05:53:03.253201Z","shell.execute_reply.started":"2024-04-10T05:53:02.561410Z","shell.execute_reply":"2024-04-10T05:53:03.252341Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Making Predictions\n","metadata":{"id":"4Qld_YmJ7gky"}},{"cell_type":"code","source":"y_predicted_by_model = cnn_model.predict(X_test)","metadata":{"id":"oLpa4hLFAP1L","executionInfo":{"status":"ok","timestamp":1671822051090,"user_tz":-360,"elapsed":5297,"user":{"displayName":"1578_Avishek Chowdhury","userId":"14734427622886483691"}},"outputId":"d920e500-8a65-4327-a693-2b075507235a","execution":{"iopub.status.busy":"2024-04-10T05:53:03.254399Z","iopub.execute_input":"2024-04-10T05:53:03.254739Z","iopub.status.idle":"2024-04-10T05:53:05.341592Z","shell.execute_reply.started":"2024-04-10T05:53:03.254710Z","shell.execute_reply":"2024-04-10T05:53:05.340742Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(y_predicted_by_model[0])\n# print(\"\\n\")\nprint(np.argmax(y_predicted_by_model[0]))","metadata":{"id":"xkKqRU1FBnFU","executionInfo":{"status":"ok","timestamp":1671822051091,"user_tz":-360,"elapsed":34,"user":{"displayName":"1578_Avishek Chowdhury","userId":"14734427622886483691"}},"outputId":"b5733896-ffff-4208-ba8b-b2301c1a909b","execution":{"iopub.status.busy":"2024-04-10T05:53:05.342832Z","iopub.execute_input":"2024-04-10T05:53:05.343151Z","iopub.status.idle":"2024-04-10T05:53:05.348899Z","shell.execute_reply.started":"2024-04-10T05:53:05.343125Z","shell.execute_reply":"2024-04-10T05:53:05.347965Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for i in range(5):\n  print(np.argmax(y_predicted_by_model[i]), end = ' ')","metadata":{"id":"6eEae5_K_9EG","executionInfo":{"status":"ok","timestamp":1671822051092,"user_tz":-360,"elapsed":27,"user":{"displayName":"1578_Avishek Chowdhury","userId":"14734427622886483691"}},"outputId":"09cd9aca-0e90-4113-e191-232de355c1d4","execution":{"iopub.status.busy":"2024-04-10T05:53:05.350258Z","iopub.execute_input":"2024-04-10T05:53:05.350524Z","iopub.status.idle":"2024-04-10T05:53:05.359349Z","shell.execute_reply.started":"2024-04-10T05:53:05.350500Z","shell.execute_reply":"2024-04-10T05:53:05.358481Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_predicted_labels = [np.argmax(i) for i in y_predicted_by_model]\ny_predicted_labels[:5]","metadata":{"id":"_qw27t5EAWgA","executionInfo":{"status":"ok","timestamp":1671822051094,"user_tz":-360,"elapsed":26,"user":{"displayName":"1578_Avishek Chowdhury","userId":"14734427622886483691"}},"outputId":"8e1bcf4f-2417-49fb-80d5-45a679ad50a8","execution":{"iopub.status.busy":"2024-04-10T05:53:05.360609Z","iopub.execute_input":"2024-04-10T05:53:05.360889Z","iopub.status.idle":"2024-04-10T05:53:05.472056Z","shell.execute_reply.started":"2024-04-10T05:53:05.360838Z","shell.execute_reply":"2024-04-10T05:53:05.471217Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset_submission[\"Label\"] = y_predicted_labels\ndataset_submission","metadata":{"execution":{"iopub.status.busy":"2024-04-10T05:53:05.473059Z","iopub.execute_input":"2024-04-10T05:53:05.473317Z","iopub.status.idle":"2024-04-10T05:53:05.598272Z","shell.execute_reply.started":"2024-04-10T05:53:05.473294Z","shell.execute_reply":"2024-04-10T05:53:05.597211Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset_submission.to_csv('submission.csv', index = False)","metadata":{"execution":{"iopub.status.busy":"2024-04-10T05:53:05.599593Z","iopub.execute_input":"2024-04-10T05:53:05.600204Z","iopub.status.idle":"2024-04-10T05:53:05.659088Z","shell.execute_reply.started":"2024-04-10T05:53:05.600171Z","shell.execute_reply":"2024-04-10T05:53:05.657879Z"},"trusted":true},"execution_count":null,"outputs":[]}]}