{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.14","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"}],"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":" <div style=\"text-align: center;\">\n    <h2 style=\"font-weight: bold;background-color:#E77471;border-bottom: 1px solid #9F8C76;border-radius: 12px 50px;font-family:cursive ;font-size: 30px;padding: 10px; margin-bottom: 10px; color:white;\"><i> Digit Recognizer Project</i></h2>\n</div>","metadata":{}},{"cell_type":"markdown","source":"<div style=\"text-align: center;\">\n    <h2 style=\"font-weight: bold; margin-bottom: 10px; color:#000080;\"><i> Welcom To Our Notebook!</i></h2>\n    <h2 style=\"font-weight: bold; margin-bottom: 10px; color:#000080;\"><i> By: Ahmed Sharaf</i></h2>\n    <img src=\"https://miro.medium.com/v2/resize:fit:1400/1*FL6DWzN-awxCaG8bS1ZD_Q.png\" alt=\"Image Title\" style=\"max-width: 50%; height: auto;\">\n</div>","metadata":{}},{"cell_type":"markdown","source":"<a id=\"toc\"></a>\n### **Table of Contents**:\n* [About the Project](#1)\n* [About the Data](#2)\n* [Import libraries ](#3)\n* [Import Data](#4)\n* [Data Preprocessing](#5)\n* [Data Augmentation](#6)\n* [Deep learning Model](#7)\n* [Evaluate Model](#8)\n* [Kaggle Submission](#8)","metadata":{}},{"cell_type":"markdown","source":"<a id=\"1\"></a>\n<div style=\"text-align:center;display:inline-block;\">\n    <h2 style=\"font-weight: bold;\n               background-color:#C2E5D3;\n               border-bottom: 1px solid #9F8C76;\n               border-radius:0px 15px;\n               border-width: 3px 5px;\n               font-family:cursive;\n               font-size: 20px;\n               padding:10px; \n               margin-bottom:10px; \n               color:#000080;\"\n        ><i> About The Project </i></h2>\n</div>","metadata":{}},{"cell_type":"markdown","source":"<div style=\"text-align:left;display:inline-block;\">\n    <h2 style=\"font-weight: bold;border-bottom: 2px solid #9F8C76;font-size: 18px;padding: 10px; margin-bottom: 10px; color:black;\"><span style = \"color:#000080; font-weight: bold;\">Goal:</span><i> CNN for multi-class prediction of handwritten digits .</i><p><br><br>\n        <span style=\"color:#000080; font-weight:bold;\">Link to Kaggle competition:</span>\n        <i><a href=\"https://www.kaggle.com/c/digit-recognizer/data\">https://www.kaggle.com/c/digit-recognizer/data</a></i>\n    </h2>\n</div>","metadata":{}},{"cell_type":"markdown","source":"<a id=\"2\"></a>\n<div style=\"text-align:center;display:inline-block;\">\n    <h2 style=\"font-weight: bold;\n               background-color:#C2E5D3;\n               border-bottom: 1px solid #9F8C76;\n               border-radius:0px 15px;\n               border-width: 3px 5px;\n               font-family:cursive;\n               font-size: 20px;\n               padding:10px; \n               margin-bottom:10px; \n               color:#000080;\"\n        ><i> About The Data </i></h2>\n</div>","metadata":{}},{"cell_type":"markdown","source":"### 📊 Data Overview\n\n- **Dataset:** MNIST Handwritten Digits\n- **Source:** [Yann LeCun's Website](http://yann.lecun.com/exdb/mnist/)\n- **Data Shape:**\n  - **Training Set:** 60,000 images\n  - **Test Set:** 10,000 images\n- **Image Properties:**\n  - **Resolution:** 28x28 pixels\n  - **Color:** Grayscale\n- **Classes:** 10 (Digits from 0 to 9)","metadata":{}},{"cell_type":"markdown","source":"<a id=\"3\"></a>\n<div style=\"text-align:center;display:inline-block;\">\n    <h2 style=\"font-weight: bold;\n               background-color:#C2E5D3;\n               border-bottom: 1px solid #9F8C76;\n               border-radius:0px 15px;\n               border-width: 3px 5px;\n               font-family:cursive;\n               font-size: 20px;\n               padding:10px; \n               margin-bottom:10px; \n               color:#000080;\"\n        ><i> Import Important libraries </i></h2>\n</div>","metadata":{}},{"cell_type":"code","source":"import numpy as np \nimport pandas as pd \nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport tensorflow as tf\nimport keras\n\nfrom keras.utils import to_categorical\nfrom sklearn.model_selection import train_test_split\nfrom tensorflow.keras.preprocessing.image import ImageDataGenerator\nfrom sklearn.metrics import confusion_matrix\n\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-10-11T17:00:16.489642Z","iopub.execute_input":"2024-10-11T17:00:16.490266Z","iopub.status.idle":"2024-10-11T17:00:16.497815Z","shell.execute_reply.started":"2024-10-11T17:00:16.490224Z","shell.execute_reply":"2024-10-11T17:00:16.496726Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"4\"></a>\n<div style=\"text-align:center;display:inline-block;\">\n    <h2 style=\"font-weight: bold;\n               background-color:#C2E5D3;\n               border-bottom: 1px solid #9F8C76;\n               border-radius:0px 15px;\n               border-width: 3px 5px;\n               font-family:cursive;\n               font-size: 20px;\n               padding:10px; \n               margin-bottom:10px; \n               color:#000080;\"\n        ><i> Import Data   </i></h2>\n</div>","metadata":{}},{"cell_type":"code","source":"train_df = pd.read_csv('/kaggle/input/digit-recognizer/train.csv')\ntest_df = pd.read_csv('/kaggle/input/digit-recognizer/test.csv')","metadata":{"execution":{"iopub.status.busy":"2024-10-11T16:23:28.812411Z","iopub.execute_input":"2024-10-11T16:23:28.813756Z","iopub.status.idle":"2024-10-11T16:23:33.128644Z","shell.execute_reply.started":"2024-10-11T16:23:28.813697Z","shell.execute_reply":"2024-10-11T16:23:33.127846Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.head()","metadata":{"execution":{"iopub.status.busy":"2024-10-11T16:23:37.909633Z","iopub.execute_input":"2024-10-11T16:23:37.910386Z","iopub.status.idle":"2024-10-11T16:23:37.926400Z","shell.execute_reply.started":"2024-10-11T16:23:37.910342Z","shell.execute_reply":"2024-10-11T16:23:37.925454Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"5\"></a>\n<div style=\"text-align:center;display:inline-block;\">\n    <h2 style=\"font-weight: bold;\n               background-color:#C2E5D3;\n               border-bottom: 1px solid #9F8C76;\n               border-radius:0px 15px;\n               border-width: 3px 5px;\n               font-family:cursive;\n               font-size: 20px;\n               padding:10px; \n               margin-bottom:10px; \n               color:#000080;\"\n        ><i> Data Preprocessing </i></h2>\n</div>","metadata":{}},{"cell_type":"code","source":"X_train = train_df.drop(columns = 'label', axis = 1)\ny_train = train_df['label']","metadata":{"execution":{"iopub.status.busy":"2024-10-11T16:23:40.054735Z","iopub.execute_input":"2024-10-11T16:23:40.055572Z","iopub.status.idle":"2024-10-11T16:23:40.137948Z","shell.execute_reply.started":"2024-10-11T16:23:40.055532Z","shell.execute_reply":"2024-10-11T16:23:40.137073Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"label_counts = y_train.value_counts().sort_index()\nplt.bar(label_counts.index, label_counts.values)\nplt.xlabel('Number')\nplt.ylabel('Count')\nplt.title('Count Of Each Number')","metadata":{"execution":{"iopub.status.busy":"2024-10-11T16:23:42.135097Z","iopub.execute_input":"2024-10-11T16:23:42.136026Z","iopub.status.idle":"2024-10-11T16:23:42.419473Z","shell.execute_reply.started":"2024-10-11T16:23:42.135970Z","shell.execute_reply":"2024-10-11T16:23:42.418515Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"###### Data Balanced","metadata":{}},{"cell_type":"code","source":"plt.figure(figsize = (40, 50))\nfor n, i in enumerate(list(np.random.randint(0, len(X_train), 36))):\n    plt.subplot(6, 6, n+1)\n    plt.imshow(X_train.iloc[i,:].values.reshape((28, 28, 1)), cmap ='gray')\n    plt.title(y_train.iloc[i], fontdict = {'fontsize': 40, 'color': 'blue'})\n    plt.axis('off')","metadata":{"execution":{"iopub.status.busy":"2024-10-11T16:23:49.260769Z","iopub.execute_input":"2024-10-11T16:23:49.261176Z","iopub.status.idle":"2024-10-11T16:23:54.796983Z","shell.execute_reply.started":"2024-10-11T16:23:49.261131Z","shell.execute_reply":"2024-10-11T16:23:54.796064Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Normalize Data\nX_train = X_train / 255.0\ntest_df = test_df / 255.0","metadata":{"execution":{"iopub.status.busy":"2024-10-11T16:24:00.069484Z","iopub.execute_input":"2024-10-11T16:24:00.069865Z","iopub.status.idle":"2024-10-11T16:24:00.172290Z","shell.execute_reply.started":"2024-10-11T16:24:00.069828Z","shell.execute_reply":"2024-10-11T16:24:00.171260Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Reshape Data\nX_train = X_train.values.reshape((-1, 28, 28, 1))\ntest = test_df.values.reshape((-1, 28, 28, 1))\nprint(\"x_train shape: \",X_train.shape)\nprint(\"test shape: \",test.shape)","metadata":{"execution":{"iopub.status.busy":"2024-10-11T16:24:03.757785Z","iopub.execute_input":"2024-10-11T16:24:03.758634Z","iopub.status.idle":"2024-10-11T16:24:03.764949Z","shell.execute_reply.started":"2024-10-11T16:24:03.758593Z","shell.execute_reply":"2024-10-11T16:24:03.763981Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Encoding\ny_train = to_categorical(y_train, num_classes=10)\ny_train","metadata":{"execution":{"iopub.status.busy":"2024-10-11T16:24:12.469627Z","iopub.execute_input":"2024-10-11T16:24:12.470361Z","iopub.status.idle":"2024-10-11T16:24:12.478372Z","shell.execute_reply.started":"2024-10-11T16:24:12.470318Z","shell.execute_reply":"2024-10-11T16:24:12.477464Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Spliting Data\nX_train, X_val, y_train, y_val = train_test_split(X_train, y_train, test_size = 0.1, random_state=2)\nprint(\"x_train shape\",X_train.shape)\nprint(\"x_test shape\",X_val.shape)\nprint(\"y_train shape\",y_train.shape)\nprint(\"y_test shape\",y_val.shape)","metadata":{"execution":{"iopub.status.busy":"2024-10-11T16:24:14.555667Z","iopub.execute_input":"2024-10-11T16:24:14.556716Z","iopub.status.idle":"2024-10-11T16:24:14.958427Z","shell.execute_reply.started":"2024-10-11T16:24:14.556655Z","shell.execute_reply":"2024-10-11T16:24:14.957254Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"6\"></a>\n<div style=\"text-align:center;display:inline-block;\">\n    <h2 style=\"font-weight: bold;\n               background-color:#C2E5D3;\n               border-bottom: 1px solid #9F8C76;\n               border-radius:0px 15px;\n               border-width: 3px 5px;\n               font-family:cursive;\n               font-size: 20px;\n               padding:10px; \n               margin-bottom:10px; \n               color:#000080;\"\n        ><i> Data Augmentation </i></h2>\n</div>","metadata":{}},{"cell_type":"code","source":"# Data Augmentation\ngen = ImageDataGenerator(\n        rotation_range=5,  # randomly rotate images in the range 5 degrees\n        zoom_range = 0.1, # Randomly zoom image 10%\n        width_shift_range=0.1,  # randomly shift images horizontally 10%\n        height_shift_range=0.1,  # randomly shift images vertically 10%\n)\n\ngen.fit(X_train)","metadata":{"execution":{"iopub.status.busy":"2024-10-11T16:24:21.702696Z","iopub.execute_input":"2024-10-11T16:24:21.703508Z","iopub.status.idle":"2024-10-11T16:24:21.796739Z","shell.execute_reply.started":"2024-10-11T16:24:21.703464Z","shell.execute_reply":"2024-10-11T16:24:21.795948Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data_iter = gen.flow(X_train, y_train, 250)\nimage, label = next(data_iter)  ","metadata":{"execution":{"iopub.status.busy":"2024-10-11T16:41:54.547764Z","iopub.execute_input":"2024-10-11T16:41:54.548272Z","iopub.status.idle":"2024-10-11T16:41:54.682529Z","shell.execute_reply.started":"2024-10-11T16:41:54.548231Z","shell.execute_reply":"2024-10-11T16:41:54.681670Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Show Some Image After Data Generator\nplt.figure(figsize = (40, 30))\nfor n, i in enumerate(list(np.random.randint(0, len(image), 36))):\n    plt.subplot(6, 6, n+1)\n    plt.imshow(image[i], cmap ='gray')\n    plt.title(np.argmax(label[i]), fontdict = {'fontsize': 40, 'color': 'blue'})\n    plt.axis('off')","metadata":{"execution":{"iopub.status.busy":"2024-10-11T16:41:54.909778Z","iopub.execute_input":"2024-10-11T16:41:54.910470Z","iopub.status.idle":"2024-10-11T16:41:58.447815Z","shell.execute_reply.started":"2024-10-11T16:41:54.910425Z","shell.execute_reply":"2024-10-11T16:41:58.446798Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"7\"></a>\n<div style=\"text-align:center;display:inline-block;\">\n    <h2 style=\"font-weight: bold;\n               background-color:#C2E5D3;\n               border-bottom: 1px solid #9F8C76;\n               border-radius:0px 15px;\n               border-width: 3px 5px;\n               font-family:cursive;\n               font-size: 20px;\n               padding:10px; \n               margin-bottom:10px; \n               color:#000080;\"\n        ><i> Deep Learning Model </i></h2>\n</div>","metadata":{}},{"cell_type":"code","source":"# Build Model\nmodel = keras.models.Sequential([\n    keras.layers.Conv2D(64, kernel_size = (3, 3), padding = 'same', activation = 'relu', input_shape = (28, 28, 1)),\n    keras.layers.Conv2D(64, kernel_size = (3, 3), padding = 'same', activation = 'relu'),\n    keras.layers.BatchNormalization(),\n    keras.layers.MaxPool2D(pool_size = (3, 3)),\n    keras.layers.Conv2D(32, kernel_size = (5, 5), padding = 'same', activation = 'relu'),\n    keras.layers.Conv2D(32, kernel_size = (5, 5), padding = 'same', activation = 'relu'),\n    keras.layers.BatchNormalization(),\n    keras.layers.MaxPool2D(pool_size = (4, 4)),\n    keras.layers.Flatten(),\n    keras.layers.Dense(64, activation = 'relu'),\n    keras.layers.Dropout(0.2),\n    keras.layers.Dense(10, activation = 'softmax')\n])\n\nmodel.compile(optimizer = 'adam', loss = 'categorical_crossentropy', metrics = ['accuracy'])\nprint(model.summary())\n","metadata":{"execution":{"iopub.status.busy":"2024-10-11T17:05:53.040568Z","iopub.execute_input":"2024-10-11T17:05:53.040975Z","iopub.status.idle":"2024-10-11T17:05:53.138998Z","shell.execute_reply.started":"2024-10-11T17:05:53.040934Z","shell.execute_reply":"2024-10-11T17:05:53.138083Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"epochs = 10\nbatch_size = 250\nhistory = model.fit(gen.flow(X_train, y_train, batch_size), epochs = epochs, validation_data = (X_val, y_val), steps_per_epoch=X_train.shape[0] // batch_size)","metadata":{"execution":{"iopub.status.busy":"2024-10-11T17:05:55.646488Z","iopub.execute_input":"2024-10-11T17:05:55.646894Z","iopub.status.idle":"2024-10-11T17:07:09.649089Z","shell.execute_reply.started":"2024-10-11T17:05:55.646856Z","shell.execute_reply":"2024-10-11T17:07:09.648077Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"8\"></a>\n<div style=\"text-align:center;display:inline-block;\">\n    <h2 style=\"font-weight: bold;\n               background-color:#C2E5D3;\n               border-bottom: 1px solid #9F8C76;\n               border-radius:0px 15px;\n               border-width: 3px 5px;\n               font-family:cursive;\n               font-size: 20px;\n               padding:10px; \n               margin-bottom:10px; \n               color:#000080;\"\n        ><i> Evaluate Model </i></h2>\n</div>","metadata":{}},{"cell_type":"code","source":"history.history.keys()","metadata":{"execution":{"iopub.status.busy":"2024-10-11T17:08:04.652556Z","iopub.execute_input":"2024-10-11T17:08:04.652927Z","iopub.status.idle":"2024-10-11T17:08:04.659896Z","shell.execute_reply.started":"2024-10-11T17:08:04.652886Z","shell.execute_reply":"2024-10-11T17:08:04.658682Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.plot(history.history['accuracy'], color = 'b', label = 'Training Accuracy')\nplt.plot(history.history['val_accuracy'], color = 'r', label = 'Validation Accuracy')\nplt.title('Traning Accuracy Vs Validation Accuracy')\nplt.legend()\nplt.xlabel('Epoch')\nplt.ylabel('Accuracy')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-10-11T17:10:31.041933Z","iopub.execute_input":"2024-10-11T17:10:31.042811Z","iopub.status.idle":"2024-10-11T17:10:31.283203Z","shell.execute_reply.started":"2024-10-11T17:10:31.042767Z","shell.execute_reply":"2024-10-11T17:10:31.282276Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.plot(history.history['loss'], color = 'b', label = 'Training Loss')\nplt.plot(history.history['val_loss'], color = 'r', label = 'Validation Loss')\nplt.title('Traning Loss Vs Validation Loss')\nplt.legend()\nplt.xlabel('Loss')\nplt.ylabel('Accuracy')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-10-11T17:10:55.382871Z","iopub.execute_input":"2024-10-11T17:10:55.383796Z","iopub.status.idle":"2024-10-11T17:10:55.616893Z","shell.execute_reply.started":"2024-10-11T17:10:55.383755Z","shell.execute_reply":"2024-10-11T17:10:55.616164Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def plot_confusion_matrix(true_labels, pred_labels, class_names):\n    \n    cm = confusion_matrix(true_labels, pred_labels)\n\n    plt.figure(figsize=(8, 6))\n    sns.heatmap(cm, annot=True, fmt=\"d\", cmap=\"Blues\", xticklabels=class_names, yticklabels=class_names)\n    \n    plt.title(\"Confusion Matrix\", fontsize=16)\n    plt.xlabel(\"Predicted Labels\", fontsize=12)\n    plt.ylabel(\"True Labels\", fontsize=12)\n    plt.tight_layout()\n    plt.show()\ny_val_pred = model.predict(X_val)\nclass_names = list(np.arange(0, 10))\npred_labels = np.argmax(y_val_pred, axis=1)  \nplot_confusion_matrix(np.argmax(y_val, axis = 1), pred_labels, class_names)","metadata":{"execution":{"iopub.status.busy":"2024-10-11T17:15:21.047034Z","iopub.execute_input":"2024-10-11T17:15:21.047436Z","iopub.status.idle":"2024-10-11T17:15:21.897450Z","shell.execute_reply.started":"2024-10-11T17:15:21.047397Z","shell.execute_reply":"2024-10-11T17:15:21.896351Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"9\"></a>\n<div style=\"text-align:center;display:inline-block;\">\n    <h2 style=\"font-weight: bold;\n               background-color:#C2E5D3;\n               border-bottom: 1px solid #9F8C76;\n               border-radius:0px 15px;\n               border-width: 3px 5px;\n               font-family:cursive;\n               font-size: 20px;\n               padding:10px; \n               margin-bottom:10px; \n               color:#000080;\"\n        ><i> Kaggle Submission </i></h2>\n</div>","metadata":{}},{"cell_type":"code","source":"final_pred = np.argmax(model.predict(test), axis = 1)","metadata":{"execution":{"iopub.status.busy":"2024-10-11T17:18:03.714265Z","iopub.execute_input":"2024-10-11T17:18:03.715156Z","iopub.status.idle":"2024-10-11T17:18:05.628460Z","shell.execute_reply.started":"2024-10-11T17:18:03.715113Z","shell.execute_reply":"2024-10-11T17:18:05.627370Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize = (40, 50))\nfor n, i in enumerate(list(np.random.randint(0, len(test), 36))):\n    plt.subplot(6, 6, n+1)\n    plt.imshow(test[i], cmap ='gray')\n    plt.title(final_pred[i], fontdict = {'fontsize': 40, 'color': 'blue'})\n    plt.axis('off')","metadata":{"execution":{"iopub.status.busy":"2024-10-11T17:19:27.873894Z","iopub.execute_input":"2024-10-11T17:19:27.874813Z","iopub.status.idle":"2024-10-11T17:19:34.634070Z","shell.execute_reply.started":"2024-10-11T17:19:27.874771Z","shell.execute_reply":"2024-10-11T17:19:34.633139Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission = pd.DataFrame(final_pred)\nsubmission.index = np.arange(1, len(final_pred) + 1)\nsubmission = submission.reset_index().rename(columns = {'index': 'ImageId', 0: 'Label'})\nsubmission","metadata":{"execution":{"iopub.status.busy":"2024-10-11T17:55:23.515156Z","iopub.execute_input":"2024-10-11T17:55:23.515553Z","iopub.status.idle":"2024-10-11T17:55:23.529215Z","shell.execute_reply.started":"2024-10-11T17:55:23.515513Z","shell.execute_reply":"2024-10-11T17:55:23.528366Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.to_csv('/kaggle/working/submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2024-10-11T17:55:30.745896Z","iopub.execute_input":"2024-10-11T17:55:30.746769Z","iopub.status.idle":"2024-10-11T17:55:30.830937Z","shell.execute_reply.started":"2024-10-11T17:55:30.746729Z","shell.execute_reply":"2024-10-11T17:55:30.830168Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.save('model.h5')","metadata":{},"execution_count":null,"outputs":[]}]}