{"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)\nfrom zipfile import ZipFile\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","execution":{"iopub.status.busy":"2023-07-26T05:23:32.994263Z","iopub.execute_input":"2023-07-26T05:23:32.995350Z","iopub.status.idle":"2023-07-26T05:23:33.035101Z","shell.execute_reply.started":"2023-07-26T05:23:32.995186Z","shell.execute_reply":"2023-07-26T05:23:33.034223Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.model_selection import train_test_split","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:23:33.038529Z","iopub.execute_input":"2023-07-26T05:23:33.038772Z","iopub.status.idle":"2023-07-26T05:23:34.013748Z","shell.execute_reply.started":"2023-07-26T05:23:33.038742Z","shell.execute_reply":"2023-07-26T05:23:34.012914Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import cv2\nimport random\nimport pickle\nfrom tqdm import tqdm\nimport matplotlib.pyplot as plt\n","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:23:34.016121Z","iopub.execute_input":"2023-07-26T05:23:34.016613Z","iopub.status.idle":"2023-07-26T05:23:34.314369Z","shell.execute_reply.started":"2023-07-26T05:23:34.016568Z","shell.execute_reply":"2023-07-26T05:23:34.313479Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import tensorflow as tf\nfrom tensorflow.keras.datasets import cifar10\nfrom tensorflow.keras.preprocessing.image import ImageDataGenerator\nfrom tensorflow.keras.models import Sequential\nfrom tensorflow.keras.layers import Dense, Dropout, Activation, Flatten\nfrom tensorflow.keras.layers import Conv2D, MaxPooling2D","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:23:34.316573Z","iopub.execute_input":"2023-07-26T05:23:34.316848Z","iopub.status.idle":"2023-07-26T05:23:39.844913Z","shell.execute_reply.started":"2023-07-26T05:23:34.316811Z","shell.execute_reply":"2023-07-26T05:23:39.843935Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nwith ZipFile('/kaggle/input/dogs-vs-cats-redux-kernels-edition/train.zip', 'r') as zip:\n    #zip.printdir()\n    zip.extractall()\n    print('done')\n","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:23:39.846258Z","iopub.execute_input":"2023-07-26T05:23:39.847645Z","iopub.status.idle":"2023-07-26T05:23:51.628806Z","shell.execute_reply.started":"2023-07-26T05:23:39.847601Z","shell.execute_reply":"2023-07-26T05:23:51.627025Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"with ZipFile('/kaggle/input/dogs-vs-cats-redux-kernels-edition/test.zip', 'r') as zip:\n    #zip.printdir()\n    zip.extractall()\n    print('done')\n","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:23:51.630431Z","iopub.execute_input":"2023-07-26T05:23:51.630722Z","iopub.status.idle":"2023-07-26T05:23:57.558779Z","shell.execute_reply.started":"2023-07-26T05:23:51.630682Z","shell.execute_reply":"2023-07-26T05:23:57.557150Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"PATH = '/kaggle/working/train'\nfilename = os.listdir(PATH)\nIMG_SIZE = 100\n\nplt.figure(figsize=(10,10))\nfor i in range(1, 7):\n    img_array = cv2.imread(os.path.join(PATH, filename[i]))\n    resize_image = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE))\n    plt.subplot(3,3, i)\n    image = cv2.cvtColor(resize_image, cv2.COLOR_BGR2RGB)\n    #plt.figure()\n    plt.axis('off')\n    plt.imshow(image)    ","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:23:57.560392Z","iopub.execute_input":"2023-07-26T05:23:57.560680Z","iopub.status.idle":"2023-07-26T05:23:58.100043Z","shell.execute_reply.started":"2023-07-26T05:23:57.560641Z","shell.execute_reply":"2023-07-26T05:23:58.099356Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\ntraining_data = []\nIMG_SIZE = 100\npath = '/kaggle/working/train'\nfilenames = os.listdir('/kaggle/working/train')\nfor img in tqdm(filenames):\n    try:\n        if img.find('cat') == -1:\n            category = 0\n        else:\n            category = 1\n        \n        img_array = cv2.imread(os.path.join(path, img), cv2.IMREAD_GRAYSCALE)\n        new_array = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE))\n        training_data.append([new_array, category])\n    except Exception as e:\n        pass\n","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:23:58.101065Z","iopub.execute_input":"2023-07-26T05:23:58.101414Z","iopub.status.idle":"2023-07-26T05:24:22.809677Z","shell.execute_reply.started":"2023-07-26T05:23:58.101365Z","shell.execute_reply":"2023-07-26T05:24:22.808751Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(10,10))\nfor i in range(1, 7):\n    plt.subplot(3,3,i)\n    plt.axis('off')\n    if training_data[10+i][1] == 0:\n        plt.title('Dog')\n    else:\n        plt.title('Cat')\n    plt.imshow(training_data[10+i][0], cmap='gray_r')","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:24:22.811318Z","iopub.execute_input":"2023-07-26T05:24:22.811618Z","iopub.status.idle":"2023-07-26T05:24:23.273943Z","shell.execute_reply.started":"2023-07-26T05:24:22.811570Z","shell.execute_reply":"2023-07-26T05:24:23.273151Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"testing_data = []\nIMG_SIZE = 100\n\npath = '/kaggle/working/test'\nfilenames = os.listdir('/kaggle/working/test')\nfor img in tqdm(filenames):\n    try:        \n        img_array = cv2.imread(os.path.join(path, img), cv2.IMREAD_GRAYSCALE)\n        new_array = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE))\n        testing_data.append([new_array])\n    except Exception as e:\n        pass","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:24:23.277864Z","iopub.execute_input":"2023-07-26T05:24:23.278437Z","iopub.status.idle":"2023-07-26T05:24:35.430205Z","shell.execute_reply.started":"2023-07-26T05:24:23.278386Z","shell.execute_reply":"2023-07-26T05:24:35.429298Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(training_data)","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:24:35.431668Z","iopub.execute_input":"2023-07-26T05:24:35.432042Z","iopub.status.idle":"2023-07-26T05:24:35.439895Z","shell.execute_reply.started":"2023-07-26T05:24:35.432001Z","shell.execute_reply":"2023-07-26T05:24:35.438873Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"random.shuffle(training_data)","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:24:35.441759Z","iopub.execute_input":"2023-07-26T05:24:35.442062Z","iopub.status.idle":"2023-07-26T05:24:35.482962Z","shell.execute_reply.started":"2023-07-26T05:24:35.442023Z","shell.execute_reply":"2023-07-26T05:24:35.481802Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nX = []\ny = []\n\nfor features, label  in training_data:\n    X.append(features)\n    y.append(label)\n    \nX = np.array(X).reshape(-1, IMG_SIZE, IMG_SIZE, 1)\n","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:24:35.484308Z","iopub.execute_input":"2023-07-26T05:24:35.484955Z","iopub.status.idle":"2023-07-26T05:24:35.608850Z","shell.execute_reply.started":"2023-07-26T05:24:35.484914Z","shell.execute_reply":"2023-07-26T05:24:35.607974Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\npickle_out =open(\"X.pickle\", \"wb\")\npickle.dump(X, pickle_out)\npickle_out.close()\n\npickle_out = open(\"y.pickle\", \"wb\")\npickle.dump(y, pickle_out)\npickle_out.close()\n","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:24:35.610075Z","iopub.execute_input":"2023-07-26T05:24:35.610467Z","iopub.status.idle":"2023-07-26T05:24:36.022976Z","shell.execute_reply.started":"2023-07-26T05:24:35.610427Z","shell.execute_reply":"2023-07-26T05:24:36.022133Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pickle_in = open(\"X.pickle\", \"rb\")\nX = pickle.load(pickle_in)\n\npickle_in = open(\"y.pickle\", \"rb\")\ny = pickle.load(pickle_in)","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:24:36.024520Z","iopub.execute_input":"2023-07-26T05:24:36.024807Z","iopub.status.idle":"2023-07-26T05:24:36.377318Z","shell.execute_reply.started":"2023-07-26T05:24:36.024768Z","shell.execute_reply":"2023-07-26T05:24:36.376399Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X = X/255.0\n\nX = np.array(X)\ny = np.array(y)\n","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:24:36.378614Z","iopub.execute_input":"2023-07-26T05:24:36.379299Z","iopub.status.idle":"2023-07-26T05:24:37.732257Z","shell.execute_reply.started":"2023-07-26T05:24:36.379249Z","shell.execute_reply":"2023-07-26T05:24:37.731400Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(X)","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:24:37.734504Z","iopub.execute_input":"2023-07-26T05:24:37.735080Z","iopub.status.idle":"2023-07-26T05:24:37.740892Z","shell.execute_reply.started":"2023-07-26T05:24:37.735036Z","shell.execute_reply":"2023-07-26T05:24:37.740018Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(y)","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:24:37.742507Z","iopub.execute_input":"2023-07-26T05:24:37.743035Z","iopub.status.idle":"2023-07-26T05:24:37.757989Z","shell.execute_reply.started":"2023-07-26T05:24:37.742993Z","shell.execute_reply":"2023-07-26T05:24:37.757290Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train, x_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state=50)","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:24:37.760721Z","iopub.execute_input":"2023-07-26T05:24:37.760936Z","iopub.status.idle":"2023-07-26T05:24:38.348728Z","shell.execute_reply.started":"2023-07-26T05:24:37.760909Z","shell.execute_reply":"2023-07-26T05:24:38.347821Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(X_train)","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:24:38.354043Z","iopub.execute_input":"2023-07-26T05:24:38.355103Z","iopub.status.idle":"2023-07-26T05:24:38.362679Z","shell.execute_reply.started":"2023-07-26T05:24:38.355044Z","shell.execute_reply":"2023-07-26T05:24:38.361817Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(y_train)","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:24:38.364508Z","iopub.execute_input":"2023-07-26T05:24:38.365120Z","iopub.status.idle":"2023-07-26T05:24:38.378305Z","shell.execute_reply.started":"2023-07-26T05:24:38.365067Z","shell.execute_reply":"2023-07-26T05:24:38.377402Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model = Sequential()\n\nmodel.add(Conv2D(256, (3,3), input_shape=X_train.shape[1:]))\nmodel.add(Activation('relu'))\nmodel.add(MaxPooling2D(pool_size=(2,2)))\n\nmodel.add(Conv2D(256, (3,3)))\nmodel.add(Activation('relu'))\nmodel.add(MaxPooling2D(pool_size=(2,2)))\n\nmodel.add(Flatten()) # this converts our 3D feature maps to 1D feature vectors\n\nmodel.add(Dense(64))\nmodel.add(Dense(1))\n\nmodel.add(Activation('sigmoid'))\n","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:24:38.380942Z","iopub.execute_input":"2023-07-26T05:24:38.382971Z","iopub.status.idle":"2023-07-26T05:24:41.329479Z","shell.execute_reply.started":"2023-07-26T05:24:38.382929Z","shell.execute_reply":"2023-07-26T05:24:41.328645Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'],)\n\nhistory = model.fit(X_train, y_train, batch_size=32, epochs=15, validation_data = (x_test, y_test))","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:24:41.330764Z","iopub.execute_input":"2023-07-26T05:24:41.331054Z","iopub.status.idle":"2023-07-26T05:30:05.665153Z","shell.execute_reply.started":"2023-07-26T05:24:41.331015Z","shell.execute_reply":"2023-07-26T05:30:05.664283Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"score = model.evaluate(x_test, y_test, verbose=0)\nprint('Test Loss:', score[0])\nprint('Test accuracy:', score[1])","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:05.666945Z","iopub.execute_input":"2023-07-26T05:30:05.667300Z","iopub.status.idle":"2023-07-26T05:30:08.728355Z","shell.execute_reply.started":"2023-07-26T05:30:05.667246Z","shell.execute_reply":"2023-07-26T05:30:08.727482Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Plotting our loss charts\n# Use the history object we created to get our saved perormace result.\nhistory_dict = history.history\n\n# Extract the loss and validation losses\nloss_values = history_dict['loss']\nval_loss_values = history_dict['val_loss']\n\nepochs = range(1, len(loss_values)+1)\n\nline1 = plt.plot(epochs, val_loss_values, label ='Validation/Test Loss')\nline2 = plt.plot(epochs, loss_values, label='Training Loss')\nplt.setp(line1, linewidth = 2.0, marker='+', markersize=10.0)\nplt.setp(line2, linewidth=2.0, marker='4', markersize=10.0)\nplt.legend()\nplt.grid(True)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:08.729646Z","iopub.execute_input":"2023-07-26T05:30:08.730289Z","iopub.status.idle":"2023-07-26T05:30:08.985819Z","shell.execute_reply.started":"2023-07-26T05:30:08.730240Z","shell.execute_reply":"2023-07-26T05:30:08.985085Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Accuracy Charts","metadata":{}},{"cell_type":"code","source":"history_dict = history.history\n\nacc_values = history_dict['accuracy']\nval_acc_values = history_dict['val_accuracy']\nepochs = range(1, len(loss_values)+1)\n\nline1 = plt.plot(epochs, val_loss_values, label='Validation/Test Accuracy')\nline2 = plt.plot(epochs, acc_values, label ='Training Accuracy')\n\nplt.setp(line1, linewidth=2.0, marker='+', markersize=10.0)\nplt.setp(line2, linewidth=2.0, marker='4', markersize=10.0)\nplt.xlabel('Epochs')\nplt.ylabel('Accuracy')\nplt.grid(True)\nplt.legend()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:08.987207Z","iopub.execute_input":"2023-07-26T05:30:08.988080Z","iopub.status.idle":"2023-07-26T05:30:09.241391Z","shell.execute_reply.started":"2023-07-26T05:30:08.988036Z","shell.execute_reply":"2023-07-26T05:30:09.240605Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"IMG_SIZE = 100\ntest = []\n\nfor features  in testing_data:\n    test.append(features)\n    \ntest = np.array(test).reshape(-1, IMG_SIZE, IMG_SIZE, 1)","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:09.242661Z","iopub.execute_input":"2023-07-26T05:30:09.243008Z","iopub.status.idle":"2023-07-26T05:30:09.308872Z","shell.execute_reply.started":"2023-07-26T05:30:09.242963Z","shell.execute_reply":"2023-07-26T05:30:09.308036Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test = test/255.0\n\ntest = np.array(test)","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:09.313990Z","iopub.execute_input":"2023-07-26T05:30:09.315827Z","iopub.status.idle":"2023-07-26T05:30:10.165797Z","shell.execute_reply.started":"2023-07-26T05:30:09.315792Z","shell.execute_reply":"2023-07-26T05:30:10.164900Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"prediction = model.predict(test) ","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:10.167042Z","iopub.execute_input":"2023-07-26T05:30:10.167361Z","iopub.status.idle":"2023-07-26T05:30:16.539406Z","shell.execute_reply.started":"2023-07-26T05:30:10.167321Z","shell.execute_reply":"2023-07-26T05:30:16.538468Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#predict_xtest = model.predict(x_test) ","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:16.541070Z","iopub.execute_input":"2023-07-26T05:30:16.541358Z","iopub.status.idle":"2023-07-26T05:30:16.545448Z","shell.execute_reply.started":"2023-07-26T05:30:16.541318Z","shell.execute_reply":"2023-07-26T05:30:16.544696Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#predict_xtest ","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:16.546830Z","iopub.execute_input":"2023-07-26T05:30:16.547301Z","iopub.status.idle":"2023-07-26T05:30:16.557333Z","shell.execute_reply.started":"2023-07-26T05:30:16.547259Z","shell.execute_reply":"2023-07-26T05:30:16.556530Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"prediction","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:16.558683Z","iopub.execute_input":"2023-07-26T05:30:16.558966Z","iopub.status.idle":"2023-07-26T05:30:16.573062Z","shell.execute_reply.started":"2023-07-26T05:30:16.558926Z","shell.execute_reply":"2023-07-26T05:30:16.572163Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"prediction.shape","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:16.574909Z","iopub.execute_input":"2023-07-26T05:30:16.575215Z","iopub.status.idle":"2023-07-26T05:30:16.587033Z","shell.execute_reply.started":"2023-07-26T05:30:16.575175Z","shell.execute_reply":"2023-07-26T05:30:16.586293Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"my_submission = pd.read_csv('/kaggle/input/dogs-vs-cats-redux-kernels-edition/sample_submission.csv')","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:16.588536Z","iopub.execute_input":"2023-07-26T05:30:16.589128Z","iopub.status.idle":"2023-07-26T05:30:16.629534Z","shell.execute_reply.started":"2023-07-26T05:30:16.589086Z","shell.execute_reply":"2023-07-26T05:30:16.628699Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"my_submission.head()","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:16.631178Z","iopub.execute_input":"2023-07-26T05:30:16.631734Z","iopub.status.idle":"2023-07-26T05:30:16.649525Z","shell.execute_reply.started":"2023-07-26T05:30:16.631684Z","shell.execute_reply":"2023-07-26T05:30:16.648621Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"my_submission['label'] = prediction","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:16.651042Z","iopub.execute_input":"2023-07-26T05:30:16.651579Z","iopub.status.idle":"2023-07-26T05:30:16.658349Z","shell.execute_reply.started":"2023-07-26T05:30:16.651537Z","shell.execute_reply":"2023-07-26T05:30:16.657518Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"my_submission['label'] = my_submission['label'].map(lambda x: 1 if x >= 0.5 else 0 )","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:16.659735Z","iopub.execute_input":"2023-07-26T05:30:16.660251Z","iopub.status.idle":"2023-07-26T05:30:16.676740Z","shell.execute_reply.started":"2023-07-26T05:30:16.660177Z","shell.execute_reply":"2023-07-26T05:30:16.675951Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"my_submission.head()","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:16.678115Z","iopub.execute_input":"2023-07-26T05:30:16.678462Z","iopub.status.idle":"2023-07-26T05:30:16.687972Z","shell.execute_reply.started":"2023-07-26T05:30:16.678416Z","shell.execute_reply":"2023-07-26T05:30:16.687243Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"my_submission['label'] = my_submission['label'].round(1)","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:16.689470Z","iopub.execute_input":"2023-07-26T05:30:16.690456Z","iopub.status.idle":"2023-07-26T05:30:16.697948Z","shell.execute_reply.started":"2023-07-26T05:30:16.690415Z","shell.execute_reply":"2023-07-26T05:30:16.697139Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"my_submission.to_csv('my_submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2023-07-26T05:30:16.699333Z","iopub.execute_input":"2023-07-26T05:30:16.699974Z","iopub.status.idle":"2023-07-26T05:30:16.733703Z","shell.execute_reply.started":"2023-07-26T05:30:16.699930Z","shell.execute_reply":"2023-07-26T05:30:16.732744Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]}]}