{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":3004,"databundleVersionId":861823,"sourceType":"competition"}],"dockerImageVersionId":30673,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"<CENTER>\n<span style=\"background:url('https://t3.ftcdn.net/jpg/04/04/73/24/360_F_404732411_zuaDyeeDSsFuc5zMxEI3eySXwtTG6awv.jpg'); padding:30px 170px; font-size: 3rem; font-weight: bold; color: gold;border-radius:0PX 100px; display: inline-block;text-align: center;\">🛸 DIGIT RECOGINIZER 🧠</span>\n</CENTER>","metadata":{}},{"cell_type":"markdown","source":"<div style=\"text-align: center;\">\n  <img src=\"https://preview.redd.it/yi7u4ebm3yv51.gif?width=362&auto=webp&s=77dc1fd25b941e186db93ae967c7ce781eaadd78\" alt=\"Description of image\" style=\"max-width:200; height: 200;border-radius:50px\">\n</div>","metadata":{}},{"cell_type":"markdown","source":"<center>\n    <span></span>\n</center>","metadata":{}},{"cell_type":"markdown","source":"<CENTER>\n<span style=\"background:url(''); padding:20px; font-size: 3rem; font-weight: bold; color: yellow;border-radius:100px; font-family:'Brush Script MT', 'Brush Script Std', cursive;display: inline-block;text-align: center;\">🦉 NECESSARY LIBRARIES ☄️</span>\n</CENTER>","metadata":{"execution":{"iopub.status.busy":"2024-05-21T14:55:52.196732Z","iopub.execute_input":"2024-05-21T14:55:52.197147Z","iopub.status.idle":"2024-05-21T14:55:52.233833Z","shell.execute_reply.started":"2024-05-21T14:55:52.197113Z","shell.execute_reply":"2024-05-21T14:55:52.232239Z"}}},{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nimport seaborn as sns\nimport matplotlib.pyplot as plt","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-05-11T15:37:52.714424Z","iopub.execute_input":"2024-05-11T15:37:52.714832Z","iopub.status.idle":"2024-05-11T15:37:52.724121Z","shell.execute_reply.started":"2024-05-11T15:37:52.714796Z","shell.execute_reply":"2024-05-11T15:37:52.723030Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import tensorflow as tf\nfrom tensorflow.keras.utils import to_categorical\nfrom tensorflow.keras.models import Sequential\nfrom tensorflow.keras.layers import Conv2D,MaxPooling2D,Dense,Flatten,Input\nfrom sklearn.model_selection import train_test_split","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<CENTER>\n<span style=\"background:url(''); padding:20px; font-size: 3rem; font-weight: bold; color: yellow;border-radius:100px; font-family:'Brush Script MT', 'Brush Script Std', cursive;display: inline-block;text-align: center;\">🪄 DATA EXPLORATION 🦣</span>\n</CENTER>","metadata":{}},{"cell_type":"code","source":"train = pd.read_csv('/kaggle/input/digit-recognizer/train.csv')\ntest = pd.read_csv('/kaggle/input/digit-recognizer/test.csv')","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:24.033831Z","iopub.execute_input":"2024-04-27T07:14:24.034221Z","iopub.status.idle":"2024-04-27T07:14:28.306383Z","shell.execute_reply.started":"2024-04-27T07:14:24.034190Z","shell.execute_reply":"2024-04-27T07:14:28.305234Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(train.shape)\nprint(test.shape)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:28.307580Z","iopub.execute_input":"2024-04-27T07:14:28.307904Z","iopub.status.idle":"2024-04-27T07:14:28.313405Z","shell.execute_reply.started":"2024-04-27T07:14:28.307880Z","shell.execute_reply":"2024-04-27T07:14:28.312077Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:28.315943Z","iopub.execute_input":"2024-04-27T07:14:28.316283Z","iopub.status.idle":"2024-04-27T07:14:28.356642Z","shell.execute_reply.started":"2024-04-27T07:14:28.316256Z","shell.execute_reply":"2024-04-27T07:14:28.355695Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:28.358085Z","iopub.execute_input":"2024-04-27T07:14:28.358406Z","iopub.status.idle":"2024-04-27T07:14:28.384245Z","shell.execute_reply.started":"2024-04-27T07:14:28.358381Z","shell.execute_reply":"2024-04-27T07:14:28.383018Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.describe()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:28.385817Z","iopub.execute_input":"2024-04-27T07:14:28.386485Z","iopub.status.idle":"2024-04-27T07:14:30.412060Z","shell.execute_reply.started":"2024-04-27T07:14:28.386447Z","shell.execute_reply":"2024-04-27T07:14:30.410982Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test.describe()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:30.413564Z","iopub.execute_input":"2024-04-27T07:14:30.414085Z","iopub.status.idle":"2024-04-27T07:14:32.115685Z","shell.execute_reply.started":"2024-04-27T07:14:30.414046Z","shell.execute_reply":"2024-04-27T07:14:32.114198Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.head()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:32.117386Z","iopub.execute_input":"2024-04-27T07:14:32.117841Z","iopub.status.idle":"2024-04-27T07:14:32.138136Z","shell.execute_reply.started":"2024-04-27T07:14:32.117799Z","shell.execute_reply":"2024-04-27T07:14:32.136990Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test.head()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:32.139755Z","iopub.execute_input":"2024-04-27T07:14:32.140214Z","iopub.status.idle":"2024-04-27T07:14:32.162446Z","shell.execute_reply.started":"2024-04-27T07:14:32.140175Z","shell.execute_reply":"2024-04-27T07:14:32.161236Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test.columns","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:32.165903Z","iopub.execute_input":"2024-04-27T07:14:32.166299Z","iopub.status.idle":"2024-04-27T07:14:32.174951Z","shell.execute_reply.started":"2024-04-27T07:14:32.166267Z","shell.execute_reply":"2024-04-27T07:14:32.173782Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train = train.drop(['label'],axis=1)\nX_train.head(5)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:32.176344Z","iopub.execute_input":"2024-04-27T07:14:32.176860Z","iopub.status.idle":"2024-04-27T07:14:32.281181Z","shell.execute_reply.started":"2024-04-27T07:14:32.176821Z","shell.execute_reply":"2024-04-27T07:14:32.280041Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_train = train['label']\ny_train.value_counts()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:32.283820Z","iopub.execute_input":"2024-04-27T07:14:32.284210Z","iopub.status.idle":"2024-04-27T07:14:32.293971Z","shell.execute_reply.started":"2024-04-27T07:14:32.284183Z","shell.execute_reply":"2024-04-27T07:14:32.292711Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(10,5))\nsns.countplot(x=y_train,width=.8)\nplt.title('Y LABELS')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:32.295687Z","iopub.execute_input":"2024-04-27T07:14:32.296508Z","iopub.status.idle":"2024-04-27T07:14:32.804550Z","shell.execute_reply.started":"2024-04-27T07:14:32.296468Z","shell.execute_reply":"2024-04-27T07:14:32.803437Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test = test.copy()\nX_test.head(5)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:32.806026Z","iopub.execute_input":"2024-04-27T07:14:32.806436Z","iopub.status.idle":"2024-04-27T07:14:32.903204Z","shell.execute_reply.started":"2024-04-27T07:14:32.806402Z","shell.execute_reply":"2024-04-27T07:14:32.902061Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train,X_test = X_train/255.0 ,X_test/255.0\nX_train.head()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:32.904432Z","iopub.execute_input":"2024-04-27T07:14:32.904741Z","iopub.status.idle":"2024-04-27T07:14:33.049477Z","shell.execute_reply.started":"2024-04-27T07:14:32.904717Z","shell.execute_reply":"2024-04-27T07:14:33.048565Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train = X_train.values.reshape(-1,28,28,1)","metadata":{"_kg_hide-output":true,"_kg_hide-input":true,"execution":{"iopub.status.busy":"2024-04-27T07:14:33.051124Z","iopub.execute_input":"2024-04-27T07:14:33.051582Z","iopub.status.idle":"2024-04-27T07:14:33.057631Z","shell.execute_reply.started":"2024-04-27T07:14:33.051544Z","shell.execute_reply":"2024-04-27T07:14:33.056368Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_train = to_categorical(y_train)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:33.059407Z","iopub.execute_input":"2024-04-27T07:14:33.059842Z","iopub.status.idle":"2024-04-27T07:14:33.069077Z","shell.execute_reply.started":"2024-04-27T07:14:33.059772Z","shell.execute_reply":"2024-04-27T07:14:33.068030Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(10,10))\nfor i in range(30):\n    plt.subplot(10,5,i+1)\n    plt.imshow(X_train[i],cmap='gray')\n    plt.axis('off')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:33.070369Z","iopub.execute_input":"2024-04-27T07:14:33.071205Z","iopub.status.idle":"2024-04-27T07:14:33.960286Z","shell.execute_reply.started":"2024-04-27T07:14:33.071163Z","shell.execute_reply":"2024-04-27T07:14:33.959172Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<CENTER>\n<span style=\"background:url(''); padding:20px; font-size: 3rem; font-weight: bold; color: yellow;border-radius:100px; font-family:'Brush Script MT', 'Brush Script Std', cursive;display: inline-block;text-align: center;\">🪹 MODEL NEURAL  NETWORK 🌐</span>\n</CENTER>","metadata":{}},{"cell_type":"markdown","source":"<div style=\"text-align: center;\">\n  <img src=\"https://miro.medium.com/v2/resize:fit:1400/1*SfRJNb5dOOPZYEFY5jDRqA.png\" alt=\"Description of image\" style=\"max-width: 100%; height: auto;border-radius:50px\">\n</div>","metadata":{}},{"cell_type":"code","source":"model = Sequential()","metadata":{"execution":{"iopub.status.busy":"2024-05-11T15:37:59.063082Z","iopub.execute_input":"2024-05-11T15:37:59.063564Z","iopub.status.idle":"2024-05-11T15:38:00.173242Z","shell.execute_reply.started":"2024-05-11T15:37:59.063528Z","shell.execute_reply":"2024-05-11T15:38:00.171532Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.add(Input(shape=(28,28,1)))\nmodel.add(Conv2D(32,(3,3),activation='relu',input_shape=(28,28,1)))\nmodel.add(MaxPooling2D(pool_size=(2,2),strides=(2,2)))\nmodel.add(Conv2D(64,(3,3),activation='relu'))\nmodel.add(MaxPooling2D(pool_size=(2,2),strides=(2,2)))\nmodel.add(Conv2D(64,(3,3),activation='relu'))\n\nmodel.summary()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:33.970369Z","iopub.execute_input":"2024-04-27T07:14:33.971368Z","iopub.status.idle":"2024-04-27T07:14:34.041182Z","shell.execute_reply.started":"2024-04-27T07:14:33.971334Z","shell.execute_reply":"2024-04-27T07:14:34.040116Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.add(Flatten())\nmodel.add(Dense(32,activation='relu'))\nmodel.add(Dense(64))\nmodel.add(Dense(10))\nmodel.add(Dense(10,activation='softmax'))","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:34.042690Z","iopub.execute_input":"2024-04-27T07:14:34.043007Z","iopub.status.idle":"2024-04-27T07:14:34.110540Z","shell.execute_reply.started":"2024-04-27T07:14:34.042980Z","shell.execute_reply":"2024-04-27T07:14:34.109409Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.summary()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:34.111856Z","iopub.execute_input":"2024-04-27T07:14:34.112207Z","iopub.status.idle":"2024-04-27T07:14:34.138088Z","shell.execute_reply.started":"2024-04-27T07:14:34.112181Z","shell.execute_reply":"2024-04-27T07:14:34.136990Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"early_stopping = tf.keras.callbacks.EarlyStopping(\n    monitor='val_loss',\n    min_delta=0,\n    patience=0,\n    verbose=0,\n    mode='auto',\n    baseline=None,\n    restore_best_weights=False,\n    start_from_epoch=0,\n)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:34.139567Z","iopub.execute_input":"2024-04-27T07:14:34.140014Z","iopub.status.idle":"2024-04-27T07:14:34.145439Z","shell.execute_reply.started":"2024-04-27T07:14:34.139976Z","shell.execute_reply":"2024-04-27T07:14:34.144300Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.compile(optimizer='adam',loss = 'categorical_crossentropy',metrics=['accuracy'])","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:34.146952Z","iopub.execute_input":"2024-04-27T07:14:34.147572Z","iopub.status.idle":"2024-04-27T07:14:34.160368Z","shell.execute_reply.started":"2024-04-27T07:14:34.147544Z","shell.execute_reply":"2024-04-27T07:14:34.159097Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train = train.drop(['label'],axis=1)\nX_train = X_train\nX_train_reshaped=X_train.values.reshape(-1,28,28,1).astype('float32')/255","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:34.161463Z","iopub.execute_input":"2024-04-27T07:14:34.161900Z","iopub.status.idle":"2024-04-27T07:14:34.383884Z","shell.execute_reply.started":"2024-04-27T07:14:34.161863Z","shell.execute_reply":"2024-04-27T07:14:34.382760Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(X_train_reshaped)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:34.385227Z","iopub.execute_input":"2024-04-27T07:14:34.385512Z","iopub.status.idle":"2024-04-27T07:14:34.391771Z","shell.execute_reply.started":"2024-04-27T07:14:34.385489Z","shell.execute_reply":"2024-04-27T07:14:34.390632Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test = test\ntest_reshaped = test.values.reshape(-1,28,28,1).astype('float32')/255","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:34.392967Z","iopub.execute_input":"2024-04-27T07:14:34.393264Z","iopub.status.idle":"2024-04-27T07:14:34.453357Z","shell.execute_reply.started":"2024-04-27T07:14:34.393240Z","shell.execute_reply":"2024-04-27T07:14:34.452261Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(test_reshaped)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:34.459471Z","iopub.execute_input":"2024-04-27T07:14:34.459814Z","iopub.status.idle":"2024-04-27T07:14:34.466458Z","shell.execute_reply.started":"2024-04-27T07:14:34.459788Z","shell.execute_reply":"2024-04-27T07:14:34.465194Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y = train.iloc[:,0]\ny.value_counts()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:34.468269Z","iopub.execute_input":"2024-04-27T07:14:34.468686Z","iopub.status.idle":"2024-04-27T07:14:34.478497Z","shell.execute_reply.started":"2024-04-27T07:14:34.468650Z","shell.execute_reply":"2024-04-27T07:14:34.477325Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y = to_categorical(y)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:34.482137Z","iopub.execute_input":"2024-04-27T07:14:34.482485Z","iopub.status.idle":"2024-04-27T07:14:34.489964Z","shell.execute_reply.started":"2024-04-27T07:14:34.482459Z","shell.execute_reply":"2024-04-27T07:14:34.489057Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train, X_test, y_train, y_test = train_test_split(X_train_reshaped, y, test_size=0.2, random_state=42)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:34.491463Z","iopub.execute_input":"2024-04-27T07:14:34.491896Z","iopub.status.idle":"2024-04-27T07:14:34.880274Z","shell.execute_reply.started":"2024-04-27T07:14:34.491856Z","shell.execute_reply":"2024-04-27T07:14:34.879179Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<CENTER>\n<span style=\"background:url(''); padding:20px; font-size: 3rem; font-weight: bold; color: yellow;border-radius:100px; font-family:'Brush Script MT', 'Brush Script Std', cursive;display: inline-block;text-align: center;\">🦖 MODEL TRAINING 🛸</span>\n</CENTER>","metadata":{}},{"cell_type":"code","source":"print(len(X_train))\nprint(len(X_test))\nprint(len(y_test))\nlen(y_train)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:34.881674Z","iopub.execute_input":"2024-04-27T07:14:34.882107Z","iopub.status.idle":"2024-04-27T07:14:34.890188Z","shell.execute_reply.started":"2024-04-27T07:14:34.882070Z","shell.execute_reply":"2024-04-27T07:14:34.889344Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<div style=\"text-align: center;\">\n  <img src=\"https://miro.medium.com/v2/resize:fit:786/format:webp/1*ATKZX26sQmuto5cc-y37gg.gif\" alt=\"Description of image\" style=\"max-width: 100%; height: auto;border-radius:50px\">\n</div>","metadata":{}},{"cell_type":"code","source":"model_history = model.fit(X_train,y_train,epochs=10,batch_size=100)#,callbacks=[early_stopping])","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:14:34.891191Z","iopub.execute_input":"2024-04-27T07:14:34.891517Z","iopub.status.idle":"2024-04-27T07:16:55.514252Z","shell.execute_reply.started":"2024-04-27T07:14:34.891492Z","shell.execute_reply":"2024-04-27T07:16:55.513331Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model_history.history.keys()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:16:55.515960Z","iopub.execute_input":"2024-04-27T07:16:55.517009Z","iopub.status.idle":"2024-04-27T07:16:55.524590Z","shell.execute_reply.started":"2024-04-27T07:16:55.516927Z","shell.execute_reply":"2024-04-27T07:16:55.523634Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.plot(model_history.history['accuracy'])\nplt.plot(model_history.history['loss'])\nplt.legend(['accuracy','val_accuracy'],loc='upper right')\nplt.title(\"model accuracy\")\nplt.xlabel(\"epoch\")\nplt.ylabel(\"accuracy\")\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:16:55.526019Z","iopub.execute_input":"2024-04-27T07:16:55.526818Z","iopub.status.idle":"2024-04-27T07:16:55.805655Z","shell.execute_reply.started":"2024-04-27T07:16:55.526783Z","shell.execute_reply":"2024-04-27T07:16:55.804482Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(model_history.history['accuracy'])","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:16:55.807086Z","iopub.execute_input":"2024-04-27T07:16:55.807433Z","iopub.status.idle":"2024-04-27T07:16:55.813766Z","shell.execute_reply.started":"2024-04-27T07:16:55.807403Z","shell.execute_reply":"2024-04-27T07:16:55.812373Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predict = model.predict(test_reshaped)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:16:55.815258Z","iopub.execute_input":"2024-04-27T07:16:55.815980Z","iopub.status.idle":"2024-04-27T07:17:01.354822Z","shell.execute_reply.started":"2024-04-27T07:16:55.815922Z","shell.execute_reply":"2024-04-27T07:17:01.353521Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predict.shape","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:17:01.357784Z","iopub.execute_input":"2024-04-27T07:17:01.358313Z","iopub.status.idle":"2024-04-27T07:17:01.366654Z","shell.execute_reply.started":"2024-04-27T07:17:01.358268Z","shell.execute_reply":"2024-04-27T07:17:01.364985Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Assuming 'predict' is a 2-dimensional array, convert it to 1-dimensional array\npredicted_labels = np.argmax(predict, axis=1)\n\nsubmission = pd.DataFrame({'ImageId': range(1, len(predicted_labels) + 1), 'Label': predicted_labels})\nsubmission.to_csv('submission.csv', index=False)\n","metadata":{"execution":{"iopub.status.busy":"2024-04-27T07:17:01.368049Z","iopub.execute_input":"2024-04-27T07:17:01.368416Z","iopub.status.idle":"2024-04-27T07:17:01.407903Z","shell.execute_reply.started":"2024-04-27T07:17:01.368386Z","shell.execute_reply":"2024-04-27T07:17:01.406803Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<div style=\"text-align: center;\">\n  <img src=\"https://i.pinimg.com/originals/e3/01/f0/e301f0b4a1fb5491f745ee0b71c744e4.gif\" alt=\"Description of image\" style=\"max-width: 100%; height: auto;border-radius:50px\">\n</div>","metadata":{}}]}