{"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":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_kg_hide-input":true,"_kg_hide-output":true,"execution":{"iopub.status.busy":"2022-10-31T19:34:43.368911Z","iopub.execute_input":"2022-10-31T19:34:43.369842Z","iopub.status.idle":"2022-10-31T19:35:53.212163Z","shell.execute_reply.started":"2022-10-31T19:34:43.369712Z","shell.execute_reply":"2022-10-31T19:35:53.211288Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import tensorflow as tf\nfrom tensorflow import keras\nfrom tensorflow.keras import layers\nfrom keras.preprocessing.image import ImageDataGenerator, load_img","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:35:53.213773Z","iopub.execute_input":"2022-10-31T19:35:53.214109Z","iopub.status.idle":"2022-10-31T19:35:58.525853Z","shell.execute_reply.started":"2022-10-31T19:35:53.214077Z","shell.execute_reply":"2022-10-31T19:35:58.524881Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nimport os","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:35:58.527108Z","iopub.execute_input":"2022-10-31T19:35:58.528695Z","iopub.status.idle":"2022-10-31T19:35:58.533444Z","shell.execute_reply.started":"2022-10-31T19:35:58.528656Z","shell.execute_reply":"2022-10-31T19:35:58.532469Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import seaborn as sns","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:35:58.536372Z","iopub.execute_input":"2022-10-31T19:35:58.53752Z","iopub.status.idle":"2022-10-31T19:35:59.002012Z","shell.execute_reply.started":"2022-10-31T19:35:58.537467Z","shell.execute_reply":"2022-10-31T19:35:59.001076Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Load the model","metadata":{}},{"cell_type":"markdown","source":"##### Input arguments / declare constants","metadata":{}},{"cell_type":"code","source":"image_size = (320, 128)\nbatch_size = 32\nBATCH_SIZE=batch_size\nIMAGE_HEIGHT=image_size[0]\nIMAGE_WIDTH=image_size[1]\n######################### Set paths to input and output data#################################################\n\n#INPUT_DIR = '../input/g2net-dataloader-2/spectrogram-images/'\nINPUT_DIR = '../input/generated-data-360x180-g2net/spectrogram-images/'\nINPUT_DIR_train = '../input/generated-data-360x180-g2net/spectrogram-images/train/'\n\nINPUT_DIR_test = '../input/generated-data-360x180-g2net/spectrogram-images/test/'\nOUTPUT_DIR = '/kaggle/working/'\nINPUT_DIR_submission='../input/g2net-detecting-continuous-gravitational-waves/sample_submission.csv'\n######################### Model Weights #####################################################################\n#path_to_weights='../input/3rd-cats-and-dogs-gravitational-balanced/save_at_48.h5'\npath_to_weights='../input/2nd-cats-and-dogs-gravitational-balanced/save_at_11.h5'\n##############################################################################################################\n\n\n\nparent_list = os.listdir(INPUT_DIR_test)\nfor i in range(2):\n    print(parent_list[i])","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:35:59.0033Z","iopub.execute_input":"2022-10-31T19:35:59.003725Z","iopub.status.idle":"2022-10-31T19:35:59.017645Z","shell.execute_reply.started":"2022-10-31T19:35:59.003689Z","shell.execute_reply":"2022-10-31T19:35:59.01665Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### reference Model","metadata":{}},{"cell_type":"code","source":"image_size = (320, 180)\nbatch_size = 32\n\ntrain_ds = tf.keras.preprocessing.image_dataset_from_directory(\n    INPUT_DIR_train,\n    validation_split=0.3,\n    subset=\"training\",\n    seed=1337,\n    image_size=image_size,\n    batch_size=batch_size,\n)\nval_ds = tf.keras.preprocessing.image_dataset_from_directory(\n    INPUT_DIR_train,\n    validation_split=0.3,\n    subset=\"validation\",\n    seed=1337,\n    image_size=image_size,\n    batch_size=batch_size,\n)","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:35:59.019247Z","iopub.execute_input":"2022-10-31T19:35:59.019716Z","iopub.status.idle":"2022-10-31T19:36:14.321461Z","shell.execute_reply.started":"2022-10-31T19:35:59.01968Z","shell.execute_reply":"2022-10-31T19:36:14.320479Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#layers.RandomFlip(\"horizontal_and_vertical\"),\n#tf.keras.layers.RandomBrightness(factor=0.2)\nfrom tensorflow.keras import layers\ndata_augmentation = keras.Sequential(\n    [\n        layers.RandomFlip(\"vertical\"), \n#         layers.GaussianNoise(stddev=0.15),\n#         layers.RandomCrop(300, 100, seed=None),\n#         layers.RandomContrast(factor=0.2),\n#         layers.RandomTranslation(height_factor = 0.8,width_factor = 0.9,fill_mode =\"nearest\",interpolation = \"bilinear\"),\n\n    ]\n)","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:36:14.322768Z","iopub.execute_input":"2022-10-31T19:36:14.324068Z","iopub.status.idle":"2022-10-31T19:36:14.354584Z","shell.execute_reply.started":"2022-10-31T19:36:14.324028Z","shell.execute_reply":"2022-10-31T19:36:14.353725Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def make_model(input_shape, num_classes):\n    inputs = keras.Input(shape=input_shape)\n    # Image augmentation block\n    x = data_augmentation(inputs)\n\n    # Entry block\n    x = layers.Rescaling(1.0 / 255)(x)\n    x = layers.Conv2D(32, 10, strides=2, padding=\"same\")(x)\n    x = layers.BatchNormalization()(x)\n    x = layers.Activation(\"relu\")(x)\n\n#     x = layers.Dropout(0.1)(x)\n    x = layers.Conv2D(64, 3, padding=\"same\")(x)\n    x = layers.BatchNormalization()(x)\n    x = layers.Activation(\"relu\")(x)\n\n#     previous_block_activation = x  # Set aside residual\n\n#     for size in [128, 256, 512, 728]:\n#         x = layers.Activation(\"relu\")(x)\n#         x = layers.SeparableConv2D(size, 3, padding=\"same\")(x)\n#         x = layers.BatchNormalization()(x)\n\n#         x = layers.Activation(\"relu\")(x)\n#         x = layers.SeparableConv2D(size, 3, padding=\"same\")(x)\n#         x = layers.BatchNormalization()(x)\n\n#         x = layers.MaxPooling2D(3, strides=2, padding=\"same\")(x)\n\n#         # Project residual\n#         residual = layers.Conv2D(size, 1, strides=2, padding=\"same\")(\n#             previous_block_activation\n#         )\n#         x = layers.add([x, residual])  # Add back residual\n#         previous_block_activation = x  # Set aside next residual\n\n    x = layers.SeparableConv2D(512, 3, padding=\"same\")(x)\n    x = layers.BatchNormalization()(x)\n    x = layers.Activation(\"relu\")(x)\n\n    x = layers.GlobalAveragePooling2D()(x)\n    if num_classes == 2:\n        activation = \"sigmoid\"\n        units = 1\n    else:\n        activation = \"softmax\"\n        units = num_classes\n\n    x = layers.Dropout(0.5)(x)\n    outputs = layers.Dense(units, activation=activation)(x)\n    return keras.Model(inputs, outputs)","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:36:14.355725Z","iopub.execute_input":"2022-10-31T19:36:14.35608Z","iopub.status.idle":"2022-10-31T19:36:14.365617Z","shell.execute_reply.started":"2022-10-31T19:36:14.356038Z","shell.execute_reply":"2022-10-31T19:36:14.364679Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Picture the model ","metadata":{}},{"cell_type":"code","source":"from keras.utils.vis_utils import plot_model\nmodel = make_model(input_shape=image_size + (3,), num_classes=2)\nkeras.utils.plot_model(model, show_shapes=True)\n","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:40:27.520878Z","iopub.execute_input":"2022-10-31T19:40:27.521559Z","iopub.status.idle":"2022-10-31T19:40:27.861686Z","shell.execute_reply.started":"2022-10-31T19:40:27.521521Z","shell.execute_reply":"2022-10-31T19:40:27.860523Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Load Model","metadata":{}},{"cell_type":"code","source":"model.load_weights(path_to_weights)","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:40:35.990122Z","iopub.execute_input":"2022-10-31T19:40:35.99054Z","iopub.status.idle":"2022-10-31T19:40:36.036076Z","shell.execute_reply.started":"2022-10-31T19:40:35.990499Z","shell.execute_reply":"2022-10-31T19:40:36.035104Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Load test datafiles","metadata":{}},{"cell_type":"code","source":"test_filenames = os.listdir(INPUT_DIR_test)\ntest_df = pd.DataFrame({\n    'filename': test_filenames\n})\nnb_samples = test_df.shape[0]","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:40:36.674033Z","iopub.execute_input":"2022-10-31T19:40:36.674387Z","iopub.status.idle":"2022-10-31T19:40:36.690022Z","shell.execute_reply.started":"2022-10-31T19:40:36.674356Z","shell.execute_reply":"2022-10-31T19:40:36.689028Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df['id']=test_df[\"filename\"].str[:-12]\n","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:40:37.039448Z","iopub.execute_input":"2022-10-31T19:40:37.039803Z","iopub.status.idle":"2022-10-31T19:40:37.054009Z","shell.execute_reply.started":"2022-10-31T19:40:37.039765Z","shell.execute_reply":"2022-10-31T19:40:37.052828Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df.tail()","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:40:37.70861Z","iopub.execute_input":"2022-10-31T19:40:37.709295Z","iopub.status.idle":"2022-10-31T19:40:37.719314Z","shell.execute_reply.started":"2022-10-31T19:40:37.709256Z","shell.execute_reply":"2022-10-31T19:40:37.718329Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### FastRUN or Not","metadata":{}},{"cell_type":"code","source":"# test_df=test_df.sample(256)\nnb_samples = test_df.shape[0]\nnb_samples","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:40:39.561318Z","iopub.execute_input":"2022-10-31T19:40:39.56168Z","iopub.status.idle":"2022-10-31T19:40:39.5704Z","shell.execute_reply.started":"2022-10-31T19:40:39.561647Z","shell.execute_reply":"2022-10-31T19:40:39.569363Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Test generator","metadata":{}},{"cell_type":"code","source":"#test_gen = ImageDataGenerator(rescale=1./255)\ntest_gen = ImageDataGenerator()\ntest_generator = test_gen.flow_from_dataframe(\n    test_df, \n    INPUT_DIR_test, \n    x_col='filename',\n    y_col=None,\n    class_mode=None,\n    target_size=(IMAGE_HEIGHT, IMAGE_WIDTH),\n    batch_size=BATCH_SIZE,\n    shuffle=False\n)","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:40:40.769108Z","iopub.execute_input":"2022-10-31T19:40:40.769491Z","iopub.status.idle":"2022-10-31T19:40:48.157461Z","shell.execute_reply.started":"2022-10-31T19:40:40.769458Z","shell.execute_reply":"2022-10-31T19:40:48.155782Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predict = model.predict_generator(test_generator, steps=np.ceil(nb_samples/BATCH_SIZE))","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:36:22.413772Z","iopub.execute_input":"2022-10-31T19:36:22.41488Z","iopub.status.idle":"2022-10-31T19:37:55.423292Z","shell.execute_reply.started":"2022-10-31T19:36:22.414839Z","shell.execute_reply":"2022-10-31T19:37:55.422167Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df['max_probability_predicted'] = np.argmax(predict, axis=-1)\ntest_df['probability'] = predict","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:40:48.160469Z","iopub.execute_input":"2022-10-31T19:40:48.161086Z","iopub.status.idle":"2022-10-31T19:40:48.168512Z","shell.execute_reply.started":"2022-10-31T19:40:48.161055Z","shell.execute_reply":"2022-10-31T19:40:48.167372Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df.tail()","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:40:51.799236Z","iopub.execute_input":"2022-10-31T19:40:51.799685Z","iopub.status.idle":"2022-10-31T19:40:51.815747Z","shell.execute_reply.started":"2022-10-31T19:40:51.799643Z","shell.execute_reply":"2022-10-31T19:40:51.814545Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df[['id','gunoi']] =test_df['id'].str.split('_',expand=True)","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:03.845982Z","iopub.execute_input":"2022-10-31T19:49:03.846345Z","iopub.status.idle":"2022-10-31T19:49:03.879051Z","shell.execute_reply.started":"2022-10-31T19:49:03.846313Z","shell.execute_reply":"2022-10-31T19:49:03.878156Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"44dd7e761_htest_power.jpg\t44dd7e761_hte\t0\t0.274918\n15948\t502b71045_ltest_power.jpg","metadata":{}},{"cell_type":"code","source":"# del hanford\n# del livingston","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:43:51.204497Z","iopub.execute_input":"2022-10-31T19:43:51.204934Z","iopub.status.idle":"2022-10-31T19:43:51.209496Z","shell.execute_reply.started":"2022-10-31T19:43:51.204847Z","shell.execute_reply":"2022-10-31T19:43:51.208497Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# hanford = test_df[test_df['filename'].str.contains('_h_')]\n# livingston= test_df[test_df['filename'].str.contains('_l_')]\nhanford = test_df[test_df['filename'].str.contains('_htest_')]\nlivingston= test_df[test_df['filename'].str.contains('_ltest_')]","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:07.708797Z","iopub.execute_input":"2022-10-31T19:49:07.709492Z","iopub.status.idle":"2022-10-31T19:49:07.734957Z","shell.execute_reply.started":"2022-10-31T19:49:07.709454Z","shell.execute_reply":"2022-10-31T19:49:07.734093Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"hanford.tail()","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:08.725498Z","iopub.execute_input":"2022-10-31T19:49:08.725877Z","iopub.status.idle":"2022-10-31T19:49:08.740082Z","shell.execute_reply.started":"2022-10-31T19:49:08.72584Z","shell.execute_reply":"2022-10-31T19:49:08.739169Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"livingston.tail()","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:09.551616Z","iopub.execute_input":"2022-10-31T19:49:09.551991Z","iopub.status.idle":"2022-10-31T19:49:09.564459Z","shell.execute_reply.started":"2022-10-31T19:49:09.551958Z","shell.execute_reply":"2022-10-31T19:49:09.563488Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"livingston.head()","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:10.511056Z","iopub.execute_input":"2022-10-31T19:49:10.511421Z","iopub.status.idle":"2022-10-31T19:49:10.52287Z","shell.execute_reply.started":"2022-10-31T19:49:10.511389Z","shell.execute_reply":"2022-10-31T19:49:10.52184Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df=pd.DataFrame()","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:11.394856Z","iopub.execute_input":"2022-10-31T19:49:11.395202Z","iopub.status.idle":"2022-10-31T19:49:11.400623Z","shell.execute_reply.started":"2022-10-31T19:49:11.395171Z","shell.execute_reply":"2022-10-31T19:49:11.399517Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.head()","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:12.712586Z","iopub.execute_input":"2022-10-31T19:49:12.712973Z","iopub.status.idle":"2022-10-31T19:49:12.721427Z","shell.execute_reply.started":"2022-10-31T19:49:12.712938Z","shell.execute_reply":"2022-10-31T19:49:12.720288Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission=pd.read_csv(INPUT_DIR_submission)","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:13.553883Z","iopub.execute_input":"2022-10-31T19:49:13.554238Z","iopub.status.idle":"2022-10-31T19:49:13.566258Z","shell.execute_reply.started":"2022-10-31T19:49:13.554208Z","shell.execute_reply":"2022-10-31T19:49:13.565404Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission.tail()","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:14.359976Z","iopub.execute_input":"2022-10-31T19:49:14.360344Z","iopub.status.idle":"2022-10-31T19:49:14.372387Z","shell.execute_reply.started":"2022-10-31T19:49:14.360312Z","shell.execute_reply":"2022-10-31T19:49:14.371322Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission.describe()","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:15.072979Z","iopub.execute_input":"2022-10-31T19:49:15.073333Z","iopub.status.idle":"2022-10-31T19:49:15.089737Z","shell.execute_reply.started":"2022-10-31T19:49:15.073302Z","shell.execute_reply":"2022-10-31T19:49:15.088806Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission['probability_hanford']=sample_submission['id'].map(hanford.set_index('id')['probability'])\nsample_submission['probability_livingston']=sample_submission['id'].map(livingston.set_index('id')['probability'])\n#df1['value'] = df1['condition'].map(df2.set_index('condition')['probability'])","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:15.987123Z","iopub.execute_input":"2022-10-31T19:49:15.988057Z","iopub.status.idle":"2022-10-31T19:49:16.003149Z","shell.execute_reply.started":"2022-10-31T19:49:15.988008Z","shell.execute_reply":"2022-10-31T19:49:16.00225Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission.fillna(0.5)","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:16.919703Z","iopub.execute_input":"2022-10-31T19:49:16.920591Z","iopub.status.idle":"2022-10-31T19:49:16.950107Z","shell.execute_reply.started":"2022-10-31T19:49:16.920542Z","shell.execute_reply":"2022-10-31T19:49:16.949066Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission.probability_hanford=1-sample_submission.probability_hanford\nsample_submission.probability_livingston=1-sample_submission.probability_livingston","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:17.962101Z","iopub.execute_input":"2022-10-31T19:49:17.962451Z","iopub.status.idle":"2022-10-31T19:49:17.968686Z","shell.execute_reply.started":"2022-10-31T19:49:17.962419Z","shell.execute_reply":"2022-10-31T19:49:17.967706Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission.describe()","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:18.527311Z","iopub.execute_input":"2022-10-31T19:49:18.528174Z","iopub.status.idle":"2022-10-31T19:49:18.549045Z","shell.execute_reply.started":"2022-10-31T19:49:18.528126Z","shell.execute_reply":"2022-10-31T19:49:18.547997Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission['target']=(sample_submission['probability_hanford']+sample_submission['probability_livingston'])/2\n#sample_submission.target=sample_submission[[\"probability_hanford\", \"probability_livingston\"]].max(axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:19.241721Z","iopub.execute_input":"2022-10-31T19:49:19.242395Z","iopub.status.idle":"2022-10-31T19:49:19.24822Z","shell.execute_reply.started":"2022-10-31T19:49:19.242359Z","shell.execute_reply":"2022-10-31T19:49:19.2471Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission.describe()","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:19.930296Z","iopub.execute_input":"2022-10-31T19:49:19.930655Z","iopub.status.idle":"2022-10-31T19:49:19.952682Z","shell.execute_reply.started":"2022-10-31T19:49:19.930623Z","shell.execute_reply":"2022-10-31T19:49:19.951773Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.displot(sample_submission, x=\"probability_hanford\", y=\"probability_livingston\", binwidth=(.1, .1), cbar=True)","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:21.148158Z","iopub.execute_input":"2022-10-31T19:49:21.148543Z","iopub.status.idle":"2022-10-31T19:49:21.511178Z","shell.execute_reply.started":"2022-10-31T19:49:21.148509Z","shell.execute_reply":"2022-10-31T19:49:21.5101Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.displot(sample_submission, x=\"probability_hanford\", y=\"probability_livingston\", kind=\"kde\")","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:22.276215Z","iopub.execute_input":"2022-10-31T19:49:22.276559Z","iopub.status.idle":"2022-10-31T19:49:27.204529Z","shell.execute_reply.started":"2022-10-31T19:49:22.276528Z","shell.execute_reply":"2022-10-31T19:49:27.203467Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.displot(sample_submission, x=\"target\", kde=True)","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:27.20656Z","iopub.execute_input":"2022-10-31T19:49:27.206948Z","iopub.status.idle":"2022-10-31T19:49:28.723334Z","shell.execute_reply.started":"2022-10-31T19:49:27.206914Z","shell.execute_reply":"2022-10-31T19:49:28.722354Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission = sample_submission.drop(columns=[\"probability_hanford\",\"probability_livingston\"])","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:28.72719Z","iopub.execute_input":"2022-10-31T19:49:28.73128Z","iopub.status.idle":"2022-10-31T19:49:28.739961Z","shell.execute_reply.started":"2022-10-31T19:49:28.73124Z","shell.execute_reply":"2022-10-31T19:49:28.73903Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"if os.path.exists(\"/kaggle/working/model.png\"):\n        os.remove(\"/kaggle/working/model.png\")\nelse:\n        print('nofile')","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:28.744004Z","iopub.execute_input":"2022-10-31T19:49:28.749483Z","iopub.status.idle":"2022-10-31T19:49:28.755082Z","shell.execute_reply.started":"2022-10-31T19:49:28.749445Z","shell.execute_reply":"2022-10-31T19:49:28.754116Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission.tail()","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:28.756278Z","iopub.execute_input":"2022-10-31T19:49:28.757292Z","iopub.status.idle":"2022-10-31T19:49:28.77695Z","shell.execute_reply.started":"2022-10-31T19:49:28.757257Z","shell.execute_reply":"2022-10-31T19:49:28.775873Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test=pd.read_csv(INPUT_DIR_submission)\ntest.tail()","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:28.778135Z","iopub.execute_input":"2022-10-31T19:49:28.779007Z","iopub.status.idle":"2022-10-31T19:49:28.810937Z","shell.execute_reply.started":"2022-10-31T19:49:28.778971Z","shell.execute_reply":"2022-10-31T19:49:28.809997Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission.to_csv('submission.csv',index=False)","metadata":{"execution":{"iopub.status.busy":"2022-10-31T19:49:28.812116Z","iopub.execute_input":"2022-10-31T19:49:28.812991Z","iopub.status.idle":"2022-10-31T19:49:28.847207Z","shell.execute_reply.started":"2022-10-31T19:49:28.812955Z","shell.execute_reply":"2022-10-31T19:49:28.846297Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}