{"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":"markdown","source":"# Pretrained model with Keras","metadata":{"_uuid":"ebd7216c-eb44-42a5-8266-71d90eceae2b","_cell_guid":"a220bb33-026f-4bb7-b71a-07c6debdb8ff","papermill":{"duration":0.034962,"end_time":"2022-02-05T23:31:40.553165","exception":false,"start_time":"2022-02-05T23:31:40.518203","status":"completed"},"tags":[],"trusted":true}},{"cell_type":"markdown","source":"\n### Please if this kernel is useful, <font color='red'>please upvote !!</font>","metadata":{"_uuid":"26f66847-eaad-42a7-a7de-866c30d5da3d","_cell_guid":"06c97e75-24bc-4ff7-919f-c58a774decb0","papermill":{"duration":0.030674,"end_time":"2022-02-05T23:31:40.612874","exception":false,"start_time":"2022-02-05T23:31:40.5822","status":"completed"},"tags":[],"trusted":true}},{"cell_type":"markdown","source":"This kernel is based on: [cnn-with-keras-stater](https://www.kaggle.com/ammarnassanalhajali/cnn-with-keras-stater)","metadata":{"_uuid":"71964899-e5a4-4215-a821-f67c65c6f8a8","_cell_guid":"0ecebc8c-6047-47c9-bcc5-b2a47adcdcb1","trusted":true}},{"cell_type":"markdown","source":"### Importing Libraries","metadata":{"_uuid":"0676818c-1b21-4e97-8720-f918f054b3fa","_cell_guid":"58895720-2f42-41be-a736-2e85ce52f2c1","papermill":{"duration":0.029876,"end_time":"2022-02-05T23:31:40.67392","exception":false,"start_time":"2022-02-05T23:31:40.644044","status":"completed"},"tags":[],"trusted":true}},{"cell_type":"code","source":"import numpy as np \nimport pandas as pd \nimport os\nimport gc\nimport sys\nimport matplotlib.pyplot as plt\nimport matplotlib.image as mplimg\nfrom matplotlib.pyplot import imshow\nfrom tqdm.autonotebook import tqdm\n\nfrom sklearn.preprocessing import LabelEncoder\nfrom sklearn.preprocessing import OneHotEncoder\n\nimport keras.backend as K\nfrom keras.models import Sequential\nfrom keras import layers\nfrom keras.preprocessing import image\nfrom keras.applications.imagenet_utils import preprocess_input\nfrom keras.layers import Input, Dense, Activation, BatchNormalization, Flatten, Conv2D\nfrom keras.layers import AveragePooling2D, MaxPooling2D, Dropout\nfrom tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau\nfrom keras.models import Model\nfrom keras.models import load_model\nimport tensorflow as tf\n\nimport warnings\nwarnings.filterwarnings(\"ignore\", category=DeprecationWarning)","metadata":{"_uuid":"503aaa27-d9a0-4a41-9562-fe6bd801a98d","_cell_guid":"0f4c50b1-6f8f-4e83-bd00-72ddd4322a35","collapsed":false,"papermill":{"duration":7.153222,"end_time":"2022-02-05T23:31:47.856874","exception":false,"start_time":"2022-02-05T23:31:40.703652","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-04-08T20:05:17.799506Z","iopub.execute_input":"2022-04-08T20:05:17.799769Z","iopub.status.idle":"2022-04-08T20:05:23.622474Z","shell.execute_reply.started":"2022-04-08T20:05:17.799696Z","shell.execute_reply":"2022-04-08T20:05:23.6217Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"gpus = tf.config.experimental.list_physical_devices('GPU')\nfor gpu in gpus:\n    print(\"Name:\", gpu.name, \"  Type:\", gpu.device_type)\nfrom tensorflow.python.client import device_lib\n\ndevice_lib.list_local_devices()\n\nprint(tf.test.is_gpu_available())","metadata":{"_uuid":"e457fe2b-9d08-4f3f-93c8-35d3f4049414","_cell_guid":"6d034c1c-170c-4891-9ee6-42cf4b535de4","collapsed":false,"execution":{"iopub.status.busy":"2022-04-08T20:05:23.62551Z","iopub.execute_input":"2022-04-08T20:05:23.626013Z","iopub.status.idle":"2022-04-08T20:05:25.778511Z","shell.execute_reply.started":"2022-04-08T20:05:23.625983Z","shell.execute_reply":"2022-04-08T20:05:25.777878Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df = pd.read_csv(\"../input/happy-whale-and-dolphin/train.csv\")\n#train_df=train_df.drop_duplicates(subset=['individual_id'],keep='last')\ntrain_df.head()\ntrain_df_small = train_df[:50]\nprint(train_df_small.image)","metadata":{"_uuid":"497fed34-9539-49c0-8197-649c5f13618e","_cell_guid":"ae08ad4f-f33c-433e-8d20-06ac109dad43","collapsed":false,"papermill":{"duration":0.180775,"end_time":"2022-02-05T23:31:48.055908","exception":false,"start_time":"2022-02-05T23:31:47.875133","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-04-08T20:05:33.062171Z","iopub.execute_input":"2022-04-08T20:05:33.062434Z","iopub.status.idle":"2022-04-08T20:05:33.157301Z","shell.execute_reply.started":"2022-04-08T20:05:33.062399Z","shell.execute_reply":"2022-04-08T20:05:33.156628Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(train_df.shape)\nprint(train_df_small.shape)","metadata":{"_uuid":"dfcb69cf-4d3f-48cb-b1ef-afb5027a936a","_cell_guid":"7a69881c-981f-488f-8a2c-bfd502eee618","collapsed":false,"papermill":{"duration":0.043973,"end_time":"2022-02-05T23:31:48.130304","exception":false,"start_time":"2022-02-05T23:31:48.086331","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-04-08T20:05:35.991899Z","iopub.execute_input":"2022-04-08T20:05:35.992534Z","iopub.status.idle":"2022-04-08T20:05:35.998015Z","shell.execute_reply.started":"2022-04-08T20:05:35.992493Z","shell.execute_reply":"2022-04-08T20:05:35.997326Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img = image.load_img('../input/happy-whale-and-dolphin/train_images/002618d6f63ebc.jpg')\nimg","metadata":{"_uuid":"11315a82-4bfa-4f3a-803a-25487dfef9cc","_cell_guid":"556cb634-27f8-430c-a12b-610c54505775","collapsed":false,"execution":{"iopub.status.busy":"2022-04-08T20:05:38.624229Z","iopub.execute_input":"2022-04-08T20:05:38.624794Z","iopub.status.idle":"2022-04-08T20:05:39.38102Z","shell.execute_reply.started":"2022-04-08T20:05:38.624757Z","shell.execute_reply":"2022-04-08T20:05:39.380288Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img = plt.imread('../input/happy-whale-and-dolphin/train_images/002618d6f63ebc.jpg')\nimg.shape","metadata":{"_uuid":"25678cf3-c87a-496e-a1b1-acb95a58bfa5","_cell_guid":"1a4821c1-bbda-4c06-b205-d513c0bc5593","collapsed":false,"execution":{"iopub.status.busy":"2022-04-08T20:05:41.704594Z","iopub.execute_input":"2022-04-08T20:05:41.70485Z","iopub.status.idle":"2022-04-08T20:05:41.736465Z","shell.execute_reply.started":"2022-04-08T20:05:41.704823Z","shell.execute_reply":"2022-04-08T20:05:41.735709Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_images_list = os.listdir('../input/happy-whale-and-dolphin/train_images')\ntrain_images_list[:10]","metadata":{"_uuid":"9d22933e-1d41-486c-994f-43ca99060b75","_cell_guid":"56596c17-b40f-4049-bd5e-ac6100e0087d","collapsed":false,"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-04-08T20:06:05.807081Z","iopub.execute_input":"2022-04-08T20:06:05.807846Z","iopub.status.idle":"2022-04-08T20:06:05.834727Z","shell.execute_reply.started":"2022-04-08T20:06:05.8078Z","shell.execute_reply":"2022-04-08T20:06:05.834035Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Functions","metadata":{"_uuid":"097364b3-603d-41ae-a223-fb50a60897e0","_cell_guid":"19676bac-54ba-4bf8-a28a-3c1a786fd573","trusted":true}},{"cell_type":"code","source":"def Loading_Images(data, m, dataset):\n    print(\"Loading images\")\n    X_train = np.zeros((m, 32, 32, 3))\n    count = 0\n    for fig in tqdm(data['image']):\n        img = image.load_img(\"../input/happy-whale-and-dolphin/\"+dataset+\"/\"+fig, target_size=(32, 32, 3))\n        x = image.img_to_array(img)\n        x = preprocess_input(x)\n        X_train[count] = x\n        count += 1\n    return X_train\n\ndef prepare_labels(y):  # 先转成int编码，再转成one-hot\n    values = np.array(y)\n    label_encoder = LabelEncoder() # #获取一个LabelEncoder\n    integer_encoded = label_encoder.fit_transform(values)  #训练LabelEncoder,使用训练好的LabelEncoder对原数据进行编码\n    onehot_encoder = OneHotEncoder(sparse=False)\n    integer_encoded = integer_encoded.reshape(len(integer_encoded), 1)\n    onehot_encoded = onehot_encoder.fit_transform(integer_encoded)\n    y = onehot_encoded\n    return y, label_encoder","metadata":{"_uuid":"64d5a1db-8920-4e1a-9966-4745a5e4979d","_cell_guid":"9dea28d0-3581-4342-9241-2fc99cafc67e","collapsed":false,"papermill":{"duration":0.050739,"end_time":"2022-02-05T23:31:48.21012","exception":false,"start_time":"2022-02-05T23:31:48.159381","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-04-08T20:06:25.63811Z","iopub.execute_input":"2022-04-08T20:06:25.638375Z","iopub.status.idle":"2022-04-08T20:06:25.649919Z","shell.execute_reply.started":"2022-04-08T20:06:25.638347Z","shell.execute_reply":"2022-04-08T20:06:25.649063Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X = Loading_Images(train_df, train_df.shape[0], \"train_images\")\nX /= 255","metadata":{"_uuid":"1d8ac68e-11d5-4b30-ab74-fc85a3945937","_cell_guid":"da8d44c5-ba9c-45c0-ae27-7438917e4b34","collapsed":false,"papermill":{"duration":5274.644854,"end_time":"2022-02-06T00:59:42.885337","exception":false,"start_time":"2022-02-05T23:31:48.240483","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-04-08T20:06:26.800847Z","iopub.execute_input":"2022-04-08T20:06:26.801115Z","iopub.status.idle":"2022-04-08T21:08:46.942452Z","shell.execute_reply.started":"2022-04-08T20:06:26.801085Z","shell.execute_reply":"2022-04-08T21:08:46.941761Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y, label_encoder = prepare_labels(train_df['individual_id'])","metadata":{"_uuid":"e2ab395e-fec1-452b-883d-78a0d75a6074","_cell_guid":"eaa139ff-a1a9-49d3-9796-3373ea92f29a","collapsed":false,"papermill":{"duration":0.353086,"end_time":"2022-02-06T00:59:43.257414","exception":false,"start_time":"2022-02-06T00:59:42.904328","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-04-08T21:08:46.944198Z","iopub.execute_input":"2022-04-08T21:08:46.944475Z","iopub.status.idle":"2022-04-08T21:08:47.219132Z","shell.execute_reply.started":"2022-04-08T21:08:46.944438Z","shell.execute_reply":"2022-04-08T21:08:47.218417Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(X.shape)\nprint(y.shape)\ngc.collect()","metadata":{"_uuid":"1d97e8e3-f247-445d-9e12-0b11808fb107","_cell_guid":"4360c8b1-1b1a-4e8a-bddf-d26011f5a3b8","collapsed":false,"papermill":{"duration":0.20682,"end_time":"2022-02-06T00:59:43.482592","exception":false,"start_time":"2022-02-06T00:59:43.275772","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-04-08T21:08:47.220711Z","iopub.execute_input":"2022-04-08T21:08:47.220973Z","iopub.status.idle":"2022-04-08T21:08:47.370493Z","shell.execute_reply.started":"2022-04-08T21:08:47.220939Z","shell.execute_reply":"2022-04-08T21:08:47.369798Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nfrom tensorflow.keras.applications import ResNet50\n\nbase_model = ResNet50(\n               input_shape=(32,32,3), \n               weights=None,\n               include_top=False)\n\nlayer = base_model.output\nlayer = Dense(1024, activation='relu')(layer)\nlayer = Flatten()(layer)\npredictions = Dense(y.shape[1], activation='softmax')(layer)\n\nmodel = Model(inputs=base_model.input, outputs=predictions)\n\nmodel.compile(loss='categorical_crossentropy', optimizer=\"adam\", metrics=['accuracy'])\nmodel.summary()","metadata":{"_uuid":"efe7e0cb-0db0-4e9b-9c79-6d0df9a1e3e9","_cell_guid":"0eb7bcec-911f-4233-ad85-70f3c41fd941","collapsed":false,"execution":{"iopub.status.busy":"2022-04-08T21:08:47.372435Z","iopub.execute_input":"2022-04-08T21:08:47.373016Z","iopub.status.idle":"2022-04-08T21:08:48.756545Z","shell.execute_reply.started":"2022-04-08T21:08:47.372975Z","shell.execute_reply":"2022-04-08T21:08:48.755859Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"history = model.fit(X, y, epochs=150, batch_size=128, verbose=1)\nmodel.save('./model.h5')","metadata":{"_uuid":"e957fef7-e35c-4c9d-8568-cbec7710742e","_cell_guid":"3889c8fe-9b28-47fc-8c0f-b860fbf8867f","collapsed":false,"_kg_hide-output":true,"papermill":{"duration":936.68661,"end_time":"2022-02-06T01:15:23.381149","exception":false,"start_time":"2022-02-06T00:59:46.694539","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-04-08T21:08:48.757732Z","iopub.execute_input":"2022-04-08T21:08:48.75797Z","iopub.status.idle":"2022-04-08T22:10:29.978527Z","shell.execute_reply.started":"2022-04-08T21:08:48.757935Z","shell.execute_reply":"2022-04-08T22:10:29.977745Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"del X\ndel y\ngc.collect()","metadata":{"_uuid":"d7c5eb34-c3af-4335-b348-17b8f5b214c0","_cell_guid":"758131f0-4a50-4540-8f8c-e204d1b4ddeb","collapsed":false,"papermill":{"duration":6.478547,"end_time":"2022-02-06T01:15:35.684424","exception":false,"start_time":"2022-02-06T01:15:29.205877","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-04-08T22:10:29.980021Z","iopub.execute_input":"2022-04-08T22:10:29.980276Z","iopub.status.idle":"2022-04-08T22:10:30.420173Z","shell.execute_reply.started":"2022-04-08T22:10:29.98024Z","shell.execute_reply":"2022-04-08T22:10:30.419394Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Evaluation","metadata":{"_uuid":"efa05721-d7bc-4da8-8f57-f3c7e6e1a8bd","_cell_guid":"47eb523d-3b2c-40ba-8d57-2a164dca08c4","trusted":true}},{"cell_type":"code","source":"plt.figure(figsize=(15,5))\nplt.plot(history.history['accuracy'])\nplt.title('Model accuracy')\nplt.ylabel('Accuracy')\nplt.xlabel('Epoch')\nplt.show()","metadata":{"_uuid":"e4a21573-b391-41b3-b7b4-380cc2a4162d","_cell_guid":"59c522e8-714f-4283-969b-f83ddb6c744e","collapsed":false,"papermill":{"duration":5.5474,"end_time":"2022-02-06T01:15:46.890467","exception":false,"start_time":"2022-02-06T01:15:41.343067","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-04-08T22:10:30.421521Z","iopub.execute_input":"2022-04-08T22:10:30.421846Z","iopub.status.idle":"2022-04-08T22:10:30.640814Z","shell.execute_reply.started":"2022-04-08T22:10:30.421805Z","shell.execute_reply":"2022-04-08T22:10:30.640192Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,5))\nplt.plot(history.history['loss'])\nplt.title('Model loss')\nplt.ylabel('loss')\nplt.xlabel('Epoch')\nplt.show()","metadata":{"_uuid":"f8f108ef-8915-4287-bd52-1c1ebdf50533","_cell_guid":"a412f0a5-6893-443b-98a9-e65e0d14dcfd","collapsed":false,"papermill":{"duration":5.642791,"end_time":"2022-02-06T01:15:58.272765","exception":false,"start_time":"2022-02-06T01:15:52.629974","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-04-08T22:10:30.64208Z","iopub.execute_input":"2022-04-08T22:10:30.642317Z","iopub.status.idle":"2022-04-08T22:10:30.848854Z","shell.execute_reply.started":"2022-04-08T22:10:30.642285Z","shell.execute_reply":"2022-04-08T22:10:30.847537Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### inference","metadata":{"_uuid":"c3ca3699-42e2-4c50-abc1-4517750c7f48","_cell_guid":"ba53f4e1-f4f3-42fc-9435-38b81da4b802","trusted":true}},{"cell_type":"code","source":"test = os.listdir(\"../input/happy-whale-and-dolphin/test_images\")\nprint(len(test))","metadata":{"_uuid":"56d95599-7724-4e0a-aee8-2d1151b0c223","_cell_guid":"f196bae8-629f-4ed0-b038-fee8cb0ea52f","collapsed":false,"papermill":{"duration":5.883234,"end_time":"2022-02-06T01:16:10.232707","exception":false,"start_time":"2022-02-06T01:16:04.349473","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-04-08T22:10:30.850272Z","iopub.execute_input":"2022-04-08T22:10:30.850602Z","iopub.status.idle":"2022-04-08T22:10:31.467222Z","shell.execute_reply.started":"2022-04-08T22:10:30.850564Z","shell.execute_reply":"2022-04-08T22:10:31.466518Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"col = ['image']\ntest_df = pd.DataFrame(test, columns=col)\ntest_df['predictions'] = ''\n#test_df=test_df.head(n=250)","metadata":{"_uuid":"31ae9246-710d-40c6-afe0-f3ba023297ef","_cell_guid":"8559241c-1677-467c-87d8-87278811a2fc","collapsed":false,"papermill":{"duration":5.475832,"end_time":"2022-02-06T01:16:21.392852","exception":false,"start_time":"2022-02-06T01:16:15.91702","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-04-08T22:10:31.47213Z","iopub.execute_input":"2022-04-08T22:10:31.47399Z","iopub.status.idle":"2022-04-08T22:10:31.48915Z","shell.execute_reply.started":"2022-04-08T22:10:31.47395Z","shell.execute_reply":"2022-04-08T22:10:31.488531Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model = load_model(r'./model.h5')","metadata":{"_uuid":"e6cfd417-c377-48c3-a045-1caad2e38287","_cell_guid":"61981b42-6f40-4970-861b-ee838837d60c","collapsed":false,"execution":{"iopub.status.busy":"2022-04-08T22:12:31.126477Z","iopub.execute_input":"2022-04-08T22:12:31.127015Z","iopub.status.idle":"2022-04-08T22:12:33.537971Z","shell.execute_reply.started":"2022-04-08T22:12:31.126979Z","shell.execute_reply":"2022-04-08T22:12:33.537251Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"batch_size=5000\nbatch_start = 0\nbatch_end = batch_size\nL = len(test_df)\n\nwhile batch_start < L:\n    limit = min(batch_end, L)\n    test_df_batch = test_df.iloc[batch_start:limit]\n    print(type(test_df_batch))\n    X = Loading_Images(test_df_batch, test_df_batch.shape[0], \"test_images\")\n    X /= 255\n    predictions = model.predict(np.array(X), verbose=1)\n    for i, pred in enumerate(predictions):\n        p=pred.argsort()[-5:][::-1]\n        idx=-1\n        s=''\n        s1=''\n        s2=''\n        for x in p:\n            idx=idx+1\n            if pred[x]>0.5:\n                s1 = s1 + ' ' +  label_encoder.inverse_transform(p)[idx]\n            else:\n                s2 = s2 + ' ' + label_encoder.inverse_transform(p)[idx]\n        s= s1 + ' new_individual' + s2\n        s = s.strip(' ')\n        test_df.loc[ batch_start + i, 'predictions'] = s\n    batch_start += batch_size   \n    batch_end += batch_size\n    del X\n    del test_df_batch\n    del predictions\n    gc.collect()","metadata":{"_uuid":"1fbaccb6-1733-4d27-8528-ad4a5eeb6924","_cell_guid":"d8c74c87-6088-453b-b1b5-882fe29d973d","collapsed":false,"papermill":{"duration":2924.164775,"end_time":"2022-02-06T02:05:11.208924","exception":false,"start_time":"2022-02-06T01:16:27.044149","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-04-08T22:12:35.878821Z","iopub.execute_input":"2022-04-08T22:12:35.879374Z","iopub.status.idle":"2022-04-08T22:48:48.795506Z","shell.execute_reply.started":"2022-04-08T22:12:35.879333Z","shell.execute_reply":"2022-04-08T22:48:48.794759Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df.to_csv('submission.csv',index=False)\ntest_df.head()","metadata":{"_uuid":"8b33ef15-bda5-4cbc-96ec-147813b956da","_cell_guid":"019f0ffe-8878-4b83-b80f-a3abd063b20b","collapsed":false,"papermill":{"duration":5.911723,"end_time":"2022-02-06T02:05:22.337319","exception":false,"start_time":"2022-02-06T02:05:16.425596","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-04-08T22:50:47.706699Z","iopub.execute_input":"2022-04-08T22:50:47.707263Z","iopub.status.idle":"2022-04-08T22:50:47.848807Z","shell.execute_reply.started":"2022-04-08T22:50:47.707227Z","shell.execute_reply":"2022-04-08T22:50:47.848079Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"_uuid":"0c099765-ebf9-4821-9823-25d8a6e2c774","_cell_guid":"dba5ade9-333d-47c2-bfb0-0b9ecab9458e","collapsed":false,"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]}]}