{"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 sys\nsys.path.append('../input/kerasapplications')\nsys.path.append('../input/efficientnet-keras-source-code/')\nimport keras_applications\nimport efficientnet.tfkeras as efficientnet","metadata":{"execution":{"iopub.status.busy":"2023-01-01T13:41:26.345902Z","iopub.execute_input":"2023-01-01T13:41:26.346886Z","iopub.status.idle":"2023-01-01T13:41:33.575293Z","shell.execute_reply.started":"2023-01-01T13:41:26.346772Z","shell.execute_reply":"2023-01-01T13:41:33.573843Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from keras_applications.resnet import ResNet50","metadata":{"execution":{"iopub.status.busy":"2023-01-01T13:41:34.591635Z","iopub.execute_input":"2023-01-01T13:41:34.592222Z","iopub.status.idle":"2023-01-01T13:41:34.600571Z","shell.execute_reply.started":"2023-01-01T13:41:34.59219Z","shell.execute_reply":"2023-01-01T13:41:34.599375Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nimport tensorflow.compat.v2 as tf\n\nfrom keras import backend\nfrom keras.applications import imagenet_utils\nfrom keras.engine import training\nfrom keras.layers import VersionAwareLayers\nfrom keras.utils import data_utils\nfrom keras.utils import layer_utils\n\n# isort: off\nfrom tensorflow.python.util.tf_export import keras_export\n\nWEIGHTS_PATH = (\n    \"https://storage.googleapis.com/tensorflow/keras-applications/\"\n    \"vgg19/vgg19_weights_tf_dim_ordering_tf_kernels.h5\"\n)\nWEIGHTS_PATH_NO_TOP = (\n    \"https://storage.googleapis.com/tensorflow/\"\n    \"keras-applications/vgg19/\"\n    \"vgg19_weights_tf_dim_ordering_tf_kernels_notop.h5\"\n)\n\nlayers = VersionAwareLayers()","metadata":{"execution":{"iopub.status.busy":"2023-01-01T13:41:36.321443Z","iopub.execute_input":"2023-01-01T13:41:36.32254Z","iopub.status.idle":"2023-01-01T13:41:36.329327Z","shell.execute_reply.started":"2023-01-01T13:41:36.322478Z","shell.execute_reply":"2023-01-01T13:41:36.328098Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\nimport tensorflow as tf\nimport tensorflow.keras.layers as tfl\nfrom tensorflow.keras import backend as K\nfrom sklearn.model_selection import StratifiedKFold\nfrom tensorflow.keras.preprocessing.image import load_img, img_to_array\n\nfrom tensorflow.keras.applications import InceptionV3\nfrom tensorflow.keras import Sequential\nfrom tensorflow.keras import layers\nfrom tensorflow.keras.layers import Conv2D, MaxPooling2D, BatchNormalization, Dense, Dropout, Flatten\n\nimport os\nimport cv2\nimport glob\nimport pydicom as dicom\nimport nibabel as nib\nimport sys\n!pip install tensorflow","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-01-01T13:41:37.114343Z","iopub.execute_input":"2023-01-01T13:41:37.114707Z","iopub.status.idle":"2023-01-01T13:42:04.91647Z","shell.execute_reply.started":"2023-01-01T13:41:37.114675Z","shell.execute_reply":"2023-01-01T13:42:04.915003Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"bad = np.array([['1.2.826.0.1.3680043.10197_C1', '1.2.826.0.1.3680043.10197','C1'],\n                ['1.2.826.0.1.3680043.10454_C1', '1.2.826.0.1.3680043.10454','C1'],\n                ['1.2.826.0.1.3680043.10690_C1', '1.2.826.0.1.3680043.10690','C1']], dtype=np.object)\n\ndf_train = pd.read_csv(\"/kaggle/input/rsna-2022-cervical-spine-fracture-detection/train.csv\")\ndf_test = pd.read_csv(\"/kaggle/input/rsna-2022-cervical-spine-fracture-detection/test.csv\")\n\ntrain_images_dir = '/kaggle/input/rsna-2022-cervical-spine-fracture-detection/train_images'\ntest_images_dir = '/kaggle/input/rsna-2022-cervical-spine-fracture-detection/test_images'\n\nnew_submission = []\nmeans = df_train.median(numeric_only=True).to_dict()\nmeans = dict(zip(df_train.columns[1:], np.average(df_train.iloc[:,1:], axis=0, weights=df_train[\"patient_overall\"] + 1)))\nprediction_type = df_test['prediction_type'].tolist()\nsubmission = pd.read_csv('/kaggle/input/rsna-2022-cervical-spine-fracture-detection/sample_submission.csv')\nfor i in range(len(submission)):        \n    new_submission.append(means[prediction_type[i]])\nsubmission['fractured'] = new_submission\n\n\nif(df_test.values[0][0] == bad[0][0]): df_test = pd.DataFrame({\"row_id\": ['1.2.826.0.1.3680043.22327_C1', '1.2.826.0.1.3680043.25399_C1', '1.2.826.0.1.3680043.5876_C1'], \"StudyInstanceUID\": ['1.2.826.0.1.3680043.22327', '1.2.826.0.1.3680043.25399', '1.2.826.0.1.3680043.5876'], \"prediction_type\": [\"C1\", \"C1\", \"C1\"]})  \nprediction_type_mapping = df_test['prediction_type'].map({'C1': 0, 'C2': 1, 'C3': 2, 'C4': 3, 'C5': 4, 'C6': 5, 'C7': 6}).values","metadata":{"execution":{"iopub.status.busy":"2023-01-01T13:42:04.922344Z","iopub.execute_input":"2023-01-01T13:42:04.92501Z","iopub.status.idle":"2023-01-01T13:42:04.991264Z","shell.execute_reply.started":"2023-01-01T13:42:04.924967Z","shell.execute_reply":"2023-01-01T13:42:04.9902Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def load_dicom(path, size = 64):\n    img=dicom.dcmread(path)\n    img.PhotometricInterpretation = 'YBR_FULL'\n    data=img.pixel_array\n    data=data-np.min(data)\n    if np.max(data) != 0:\n        data=data/np.max(data)\n    data=(data*255).astype(np.uint8)        \n    return cv2.cvtColor(data.reshape(512, 512), cv2.COLOR_GRAY2RGB)\n\n    \npatients = sorted(os.listdir(train_images_dir))","metadata":{"execution":{"iopub.status.busy":"2023-01-01T13:42:04.992344Z","iopub.execute_input":"2023-01-01T13:42:04.992695Z","iopub.status.idle":"2023-01-01T13:42:05.128711Z","shell.execute_reply.started":"2023-01-01T13:42:04.992661Z","shell.execute_reply":"2023-01-01T13:42:05.12704Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"image_file = glob.glob(\"/kaggle/input/rsna-2022-cervical-spine-fracture-detection/train_images/1.2.826.0.1.3680043.10001/*.dcm\")\nplt.figure(figsize=(20, 10))\n\nfor i in range(16):\n    ax = plt.subplot(4, 4, i + 1)\n    image_path = image_file[i]\n    image = load_dicom(image_path)\n    plt.axis('off')   \n    plt.imshow(image)","metadata":{"execution":{"iopub.status.busy":"2023-01-01T13:42:05.136738Z","iopub.execute_input":"2023-01-01T13:42:05.137581Z","iopub.status.idle":"2023-01-01T13:42:07.749877Z","shell.execute_reply.started":"2023-01-01T13:42:05.13751Z","shell.execute_reply":"2023-01-01T13:42:07.748778Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"image_file = glob.glob(\"/kaggle/input/rsna-2022-cervical-spine-fracture-detection/segmentations/*.nii\")\nplt.figure(figsize=(20, 10))\n\nfor i in range(16):\n    ax = plt.subplot(4, 4, i + 1)\n    image_path = image_file[i]\n    nii_img = nib.load(image_path).get_fdata()\n    nib_image = nii_img[:,:,59]\n    plt.axis('off')\n    plt.imshow(nib_image)","metadata":{"execution":{"iopub.status.busy":"2023-01-01T13:42:07.751073Z","iopub.execute_input":"2023-01-01T13:42:07.751414Z","iopub.status.idle":"2023-01-01T13:42:27.173742Z","shell.execute_reply.started":"2023-01-01T13:42:07.751383Z","shell.execute_reply":"2023-01-01T13:42:27.172579Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def RSNATrainGenerator(train_df, batch_size, infinite = True, base_path = train_images_dir):\n    while True:\n        trainset = []\n        trainidt = []\n        trainlabel = []\n        for i in (range(len(train_df))):\n            idt = train_df.loc[i, 'StudyInstanceUID']\n            path = os.path.join(base_path, idt)\n            for im in os.listdir(path):\n                dc = dicom.read_file(os.path.join(path,im))\n                if dc.file_meta.TransferSyntaxUID.name =='JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1])':\n                    continue\n                img = load_dicom(os.path.join(path , im))\n                img = cv2.resize(img, (128 , 128))\n                image = img_to_array(img)\n                image = image / 255.0\n                trainset += [image]\n                cur_label = []\n                cur_label.append(train_df.loc[i,'C1'])\n                cur_label.append(train_df.loc[i,'C2'])\n                cur_label.append(train_df.loc[i,'C3'])\n                cur_label.append(train_df.loc[i,'C4'])\n                cur_label.append(train_df.loc[i,'C5'])\n                cur_label.append(train_df.loc[i,'C6'])\n                cur_label.append(train_df.loc[i,'C7'])\n                trainlabel += [cur_label]\n                trainidt += [idt]\n                if len(trainidt) == batch_size:                    \n                    yield np.array(trainset), np.array(trainlabel)\n                    trainset, trainlabel, trainidt = [], [], []\n            i+=1","metadata":{"execution":{"iopub.status.busy":"2023-01-01T13:42:30.383177Z","iopub.execute_input":"2023-01-01T13:42:30.383573Z","iopub.status.idle":"2023-01-01T13:42:30.395358Z","shell.execute_reply.started":"2023-01-01T13:42:30.383534Z","shell.execute_reply":"2023-01-01T13:42:30.394352Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def RSNATestGenerator(test_df, batch_size, infinite = True, base_path = test_images_dir):\n    while 1:        \n        testset=[]\n        testidt=[]\n        for i in (range(len(test_df))):        \n            if type(test_df) is list: idt = test_df[i]\n            else: idt = test_df['StudyInstanceUID'].iloc[i]\n            path = os.path.join(base_path, idt)\n            if os.path.exists(path):\n                for im in os.listdir(path):\n                    dc = dicom.read_file(os.path.join(path,im))\n                    if dc.file_meta.TransferSyntaxUID.name =='JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1])':\n                        continue\n                    img=load_dicom(os.path.join(path,im))\n                    img=cv2.resize(img,(128, 128))\n                    image=img_to_array(img)\n                    image=image/255.0\n                    testset+=[image]\n                    testidt+=[idt]\n                    if len(testset) == batch_size:                        \n                        yield np.array(testset)\n                        testset = []\n        if len(testset) > 0: yield np.array(testset)\n        if not infinite: break","metadata":{"execution":{"iopub.status.busy":"2023-01-01T13:42:33.555227Z","iopub.execute_input":"2023-01-01T13:42:33.555625Z","iopub.status.idle":"2023-01-01T13:42:33.566601Z","shell.execute_reply.started":"2023-01-01T13:42:33.555593Z","shell.execute_reply":"2023-01-01T13:42:33.565015Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def get_model():\n    inp = tfl.Input((None, None ,1))\n    x = tfl.Conv2D(3, 3, padding = 'SAME')(inp)\n    x = efficientnet.EfficientNetB5(include_top=False, weights='../input/efficientnet-weights-for-keras/noisy-student/notop/efficientnet-b5_noisy-student_notop.h5')(x)\n    x = tfl.GlobalAveragePooling2D()(x)\n    out = tfl.Dense(7, 'sigmoid')(x)\n    model = tf.keras.models.Model(inp, out)\n    model.summary()\n    model.compile(loss=\"binary_crossentropy\", optimizer = tf.keras.optimizers.Adam(learning_rate = 0.0001))\n    return model","metadata":{"execution":{"iopub.status.busy":"2023-01-01T14:19:59.036406Z","iopub.execute_input":"2023-01-01T14:19:59.037076Z","iopub.status.idle":"2023-01-01T14:19:59.04416Z","shell.execute_reply.started":"2023-01-01T14:19:59.03704Z","shell.execute_reply":"2023-01-01T14:19:59.04289Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#for train_idx, val_idx in StratifiedKFold(5).split(df_train, df_train['patient_overall']):    \n    #x_train = df_train.iloc[train_idx].reset_index()\n    #data= RSNATrainGenerator(x_train, min(len(x_train), 64), infinite = False, base_path = train_images_dir)\n    #break\n\n#model = get_model()\n#model","metadata":{"execution":{"iopub.status.busy":"2023-01-01T14:19:59.315982Z","iopub.execute_input":"2023-01-01T14:19:59.316355Z","iopub.status.idle":"2023-01-01T14:19:59.323826Z","shell.execute_reply.started":"2023-01-01T14:19:59.316321Z","shell.execute_reply":"2023-01-01T14:19:59.322637Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#ex= next(iter(data))\n#model(ex[0][:,:,:,0]).shape\nmodel = get_model()","metadata":{"execution":{"iopub.status.busy":"2023-01-01T14:20:17.86194Z","iopub.execute_input":"2023-01-01T14:20:17.862332Z","iopub.status.idle":"2023-01-01T14:20:25.397678Z","shell.execute_reply.started":"2023-01-01T14:20:17.8623Z","shell.execute_reply":"2023-01-01T14:20:25.396497Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for train_idx, val_idx in StratifiedKFold(5).split(df_train, df_train['patient_overall']):    \n    K.clear_session()\n    x_train = df_train.iloc[train_idx].reset_index()\n    x_val = df_train.iloc[val_idx].reset_index()\n    model = get_model()\n    hist = model.fit_generator(                            \n                                    RSNATrainGenerator(x_train, min(len(x_train), 64), infinite = False, base_path = train_images_dir),\n                                    epochs = 5,\n                                    verbose = 1,\n                                    callbacks = [tf.keras.callbacks.EarlyStopping(monitor = 'val_loss', patience = 2, restore_best_weights = True)],\n                                    validation_steps = max((len(x_val) // 64), 1),\n                                    steps_per_epoch = max((len(x_train) // 64), 1),\n                                    validation_data = RSNATrainGenerator(x_val, min(len(x_val), 64), infinite = False, base_path = train_images_dir),\n                              )\n    val_pred = model.predict_generator(RSNATestGenerator(x_val, min(len(df_test), 64), infinite = False, base_path = train_images_dir), steps = max((len(df_test) // 64), 1))    \n    try: # the best we can do at the moment..\n        preds = model.predict_generator(RSNATestGenerator(df_test, min(len(df_test), 64), infinite = False, base_path = test_images_dir), steps = max((len(df_test) // 64), 1))\n        \n        new_preds = []\n        for pred_idx in range(len(preds)):\n            new_preds.append(preds[pred_idx][prediction_type_mapping[pred_idx]])\n        # submission['fractured'] += preds[:, prediction_type_mapping] / 5\n        submission['fractured'] += np.array(new_preds) / 5\n        \n    except: traceback.print_exc()    ","metadata":{"execution":{"iopub.status.busy":"2023-01-01T14:01:43.050051Z","iopub.execute_input":"2023-01-01T14:01:43.05042Z","iopub.status.idle":"2023-01-01T14:03:04.386444Z","shell.execute_reply.started":"2023-01-01T14:01:43.05039Z","shell.execute_reply":"2023-01-01T14:03:04.383399Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data = RSNATrainGenerator(df_train, 64)\nsample = next(train_data)\nprint(\"input_shape:\", sample[0].shape)\nprint(\"target_shape:\", sample[1].shape)","metadata":{"execution":{"iopub.status.busy":"2023-01-01T08:40:35.929315Z","iopub.execute_input":"2023-01-01T08:40:35.929637Z","iopub.status.idle":"2023-01-01T08:40:36.641881Z","shell.execute_reply.started":"2023-01-01T08:40:35.92961Z","shell.execute_reply":"2023-01-01T08:40:36.640842Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def get_model5():       \n    ResNet50_model = tf.keras.applications.ResNet50(\n     include_top=False,\n    weights=\"imagenet\",\n    input_tensor=None,\n    input_shape=None,\n    pooling=None,\n    classes=7\n)\n   \n\n    \n    model.compile(loss=\"binary_crossentropy\", optimizer = tf.keras.optimizers.Adam(learning_rate = 0.0001))\n\n    return model","metadata":{"execution":{"iopub.status.busy":"2023-01-01T14:09:23.271766Z","iopub.execute_input":"2023-01-01T14:09:23.272146Z","iopub.status.idle":"2023-01-01T14:09:23.278159Z","shell.execute_reply.started":"2023-01-01T14:09:23.272115Z","shell.execute_reply":"2023-01-01T14:09:23.277086Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model2=get_model5()\n#model(ex[0][:,:,:,0]).shape","metadata":{"execution":{"iopub.status.busy":"2023-01-01T14:20:41.983182Z","iopub.execute_input":"2023-01-01T14:20:41.983577Z","iopub.status.idle":"2023-01-01T14:20:43.386002Z","shell.execute_reply.started":"2023-01-01T14:20:41.98354Z","shell.execute_reply":"2023-01-01T14:20:43.384996Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for train_idx, val_idx in StratifiedKFold(5).split(df_train, df_train['patient_overall']):    \n    K.clear_session()\n    x_train = df_train.iloc[train_idx].reset_index()\n    x_val = df_train.iloc[val_idx].reset_index()\n    model2 = get_model()\n    \n    hist = model3.fit_generator(                            \n        RSNATrainGenerator(x_train, min(len(x_train), 64), infinite = False, base_path = train_images_dir),\n        epochs = 1,\n        verbose = 1,\n        callbacks = [tf.keras.callbacks.EarlyStopping(monitor = 'val_loss', patience = 2, restore_best_weights = True)],\n        validation_steps = max((len(x_val) // 64), 1),\n        steps_per_epoch = max((len(x_train) // 64), 1),\n        validation_data = RSNATrainGenerator(x_val, min(len(x_val), 64), infinite = False, base_path = train_images_dir),\n  )\n    val_pred = model2.predict_generator(RSNATestGenerator(x_val, min(len(df_test), 64), infinite = False, base_path = train_images_dir), steps = max((len(df_test) // 64), 1))    \n    try: # the best we can do at the moment..\n        preds = model2.predict_generator(RSNATestGenerator(df_test, min(len(df_test), 64), infinite = False, base_path = test_images_dir), steps = max((len(df_test) // 64), 1))\n        \n        new_preds = []\n        for pred_idx in range(len(preds)):\n            new_preds.append(preds[pred_idx][prediction_type_mapping[pred_idx]])\n        # submission['fractured'] += preds[:, prediction_type_mapping] / 5\n        submission['fractured'] += np.array(new_preds) / 5\n        \n    except: traceback.print_exc()","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def get_model6():       \n    VGG16_model = tf.keras.applications.VGG16(\n    include_top=True,\n    weights=\"imagenet\",\n    input_tensor=None,\n    input_shape=None,\n    pooling=None,\n    classes=1000,\n    classifier_activation=\"softmax\",\n)\n    \n    model.compile(loss=\"binary_crossentropy\", optimizer = tf.keras.optimizers.Adam(learning_rate = 0.0001))\n\n    return model\n","metadata":{"execution":{"iopub.status.busy":"2023-01-01T14:09:28.064002Z","iopub.execute_input":"2023-01-01T14:09:28.064369Z","iopub.status.idle":"2023-01-01T14:09:28.070902Z","shell.execute_reply.started":"2023-01-01T14:09:28.064337Z","shell.execute_reply":"2023-01-01T14:09:28.069896Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model3=get_model6()\n#model(ex[0][:,:,:,0]).shape","metadata":{"execution":{"iopub.status.busy":"2023-01-01T14:10:13.674006Z","iopub.execute_input":"2023-01-01T14:10:13.674376Z","iopub.status.idle":"2023-01-01T14:10:16.093898Z","shell.execute_reply.started":"2023-01-01T14:10:13.674344Z","shell.execute_reply":"2023-01-01T14:10:16.088309Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for train_idx, val_idx in StratifiedKFold(5).split(df_train, df_train['patient_overall']):    \n    K.clear_session()\n    x_train = df_train.iloc[train_idx].reset_index()\n    x_val = df_train.iloc[val_idx].reset_index()\n    model3 = get_model6()\n    \n    hist = model.fit_generator(                            \n        RSNATrainGenerator(x_train, min(len(x_train), 64), infinite = False, base_path = train_images_dir),\n        epochs = 5,\n        verbose = 1,\n        callbacks = [tf.keras.callbacks.EarlyStopping(monitor = 'val_loss', patience = 2, restore_best_weights = True)],\n        validation_steps = max((len(x_val) // 64), 1),\n        steps_per_epoch = max((len(x_train) // 64), 1),\n        validation_data = RSNATrainGenerator(x_val, min(len(x_val), 64), infinite = False, base_path = train_images_dir),\n  )\n    val_pred = model3.predict_generator(RSNATestGenerator(x_val, min(len(df_test), 64), infinite = False, base_path = train_images_dir), steps = max((len(df_test) // 64), 1))    \n    try: # the best we can do at the moment..\n        preds = model3.predict_generator(RSNATestGenerator(df_test, min(len(df_test), 64), infinite = False, base_path = test_images_dir), steps = max((len(df_test) // 64), 1))\n        \n        new_preds = []\n        for pred_idx in range(len(preds)):\n            new_preds.append(preds[pred_idx][prediction_type_mapping[pred_idx]])\n        # submission['fractured'] += preds[:, prediction_type_mapping] / 5\n        submission['fractured'] += np.array(new_preds) / 5\n        \n    except: traceback.print_exc()","metadata":{"execution":{"iopub.status.busy":"2023-01-01T01:54:16.634845Z","iopub.execute_input":"2023-01-01T01:54:16.635241Z","iopub.status.idle":"2023-01-01T01:54:50.636026Z","shell.execute_reply.started":"2023-01-01T01:54:16.635209Z","shell.execute_reply":"2023-01-01T01:54:50.634278Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission","metadata":{"execution":{"iopub.status.busy":"2023-01-01T01:11:47.747211Z","iopub.execute_input":"2023-01-01T01:11:47.748142Z","iopub.status.idle":"2023-01-01T01:11:47.773364Z","shell.execute_reply.started":"2023-01-01T01:11:47.748104Z","shell.execute_reply":"2023-01-01T01:11:47.772387Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.to_csv('submission.csv', index = 0)","metadata":{"execution":{"iopub.status.busy":"2023-01-01T01:11:48.862903Z","iopub.execute_input":"2023-01-01T01:11:48.863925Z","iopub.status.idle":"2023-01-01T01:11:48.877992Z","shell.execute_reply.started":"2023-01-01T01:11:48.863876Z","shell.execute_reply":"2023-01-01T01:11:48.877072Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}