{"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","execution":{"iopub.status.busy":"2023-03-31T22:36:43.2768Z","iopub.execute_input":"2023-03-31T22:36:43.277162Z","iopub.status.idle":"2023-03-31T22:38:37.518789Z","shell.execute_reply.started":"2023-03-31T22:36:43.277132Z","shell.execute_reply":"2023-03-31T22:38:37.517409Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import os\nimport pandas as pd\nimport pickle\nimport numpy as np\nimport seaborn as sns\nimport secrets\nimport cv2\nfrom PIL import Image\nfrom PIL import ImageFile\nfrom sklearn.datasets import load_files\nfrom keras.utils import np_utils\nimport matplotlib.pyplot as plt\nfrom keras.layers import Conv2D, MaxPooling2D, GlobalAveragePooling2D\nfrom keras.layers import Dropout, Flatten, Dense\nfrom keras.models import Sequential\nfrom keras.utils.vis_utils import plot_model\nfrom keras.callbacks import ModelCheckpoint\nfrom keras.utils import to_categorical\nfrom sklearn.metrics import confusion_matrix\nfrom keras.preprocessing import image                  \nfrom tqdm import tqdm\nfrom tensorflow.keras.preprocessing.image import ImageDataGenerator\n\nimport seaborn as sns\nfrom sklearn.metrics import accuracy_score,precision_score,recall_score,f1_score","metadata":{"execution":{"iopub.status.busy":"2023-04-01T12:19:22.005481Z","iopub.execute_input":"2023-04-01T12:19:22.005917Z","iopub.status.idle":"2023-04-01T12:19:22.014792Z","shell.execute_reply.started":"2023-04-01T12:19:22.005869Z","shell.execute_reply":"2023-04-01T12:19:22.013445Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from tensorflow.python.client import device_lib\nprint(device_lib.list_local_devices())","metadata":{"execution":{"iopub.status.busy":"2023-04-01T12:13:34.402857Z","iopub.execute_input":"2023-04-01T12:13:34.403865Z","iopub.status.idle":"2023-04-01T12:13:38.014687Z","shell.execute_reply.started":"2023-04-01T12:13:34.403778Z","shell.execute_reply":"2023-04-01T12:13:38.013522Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!nvidia-smi","metadata":{"execution":{"iopub.status.busy":"2023-04-01T12:13:55.504096Z","iopub.execute_input":"2023-04-01T12:13:55.505061Z","iopub.status.idle":"2023-04-01T12:13:56.664488Z","shell.execute_reply.started":"2023-04-01T12:13:55.505021Z","shell.execute_reply":"2023-04-01T12:13:56.66301Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Import Data","metadata":{}},{"cell_type":"code","source":"os.chdir('/kaggle')\nos.getcwd()","metadata":{"execution":{"iopub.status.busy":"2023-04-01T11:02:50.130065Z","iopub.execute_input":"2023-04-01T11:02:50.130453Z","iopub.status.idle":"2023-04-01T11:02:50.138233Z","shell.execute_reply.started":"2023-04-01T11:02:50.130419Z","shell.execute_reply":"2023-04-01T11:02:50.137075Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"path_input = '/kaggle/input/state-farm-distracted-driver-detection'\npath_data = '/kaggle/working/'","metadata":{"execution":{"iopub.status.busy":"2023-04-01T12:19:29.296985Z","iopub.execute_input":"2023-04-01T12:19:29.297357Z","iopub.status.idle":"2023-04-01T12:19:29.302536Z","shell.execute_reply.started":"2023-04-01T12:19:29.297324Z","shell.execute_reply":"2023-04-01T12:19:29.301123Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"os.makedirs('/kaggle/working/models/self_trained')","metadata":{"execution":{"iopub.status.busy":"2023-04-01T11:00:25.917419Z","iopub.execute_input":"2023-04-01T11:00:25.918271Z","iopub.status.idle":"2023-04-01T11:00:25.923259Z","shell.execute_reply.started":"2023-04-01T11:00:25.918235Z","shell.execute_reply":"2023-04-01T11:00:25.922082Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"os.mkdir('/kaggle/working/saved')","metadata":{"execution":{"iopub.status.busy":"2023-04-01T11:03:57.630772Z","iopub.execute_input":"2023-04-01T11:03:57.631183Z","iopub.status.idle":"2023-04-01T11:03:57.636727Z","shell.execute_reply.started":"2023-04-01T11:03:57.631151Z","shell.execute_reply":"2023-04-01T11:03:57.6356Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"os.path.join(path_input,\"imgs\",\"test\")","metadata":{"execution":{"iopub.status.busy":"2023-04-01T11:05:38.570344Z","iopub.execute_input":"2023-04-01T11:05:38.570764Z","iopub.status.idle":"2023-04-01T11:05:38.579135Z","shell.execute_reply.started":"2023-04-01T11:05:38.570728Z","shell.execute_reply":"2023-04-01T11:05:38.577568Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"TEST_DIR = os.path.join(path_input,\"imgs\",\"test\")\nTRAIN_DIR = os.path.join(path_input,\"imgs\",\"train\")\nMODEL_PATH = os.path.join(path_data,\"models\",\"self_trained\")\nPICKLE_DIR = os.path.join(path_data,\"saved\",\"pickle_files\")\nCSV_DIR = os.path.join(path_data,\"saved\",\"csv_files\")","metadata":{"execution":{"iopub.status.busy":"2023-04-01T12:19:32.900112Z","iopub.execute_input":"2023-04-01T12:19:32.901059Z","iopub.status.idle":"2023-04-01T12:19:32.907967Z","shell.execute_reply.started":"2023-04-01T12:19:32.901005Z","shell.execute_reply":"2023-04-01T12:19:32.90662Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"if not os.path.exists(TEST_DIR):\n    print(\"Testing data does not exists\")\nif not os.path.exists(TRAIN_DIR):\n    print(\"Training data does not exists\")\nif not os.path.exists(MODEL_PATH):\n    print(\"Model path does not exists\")\n    os.makedirs(MODEL_PATH)\n    print(\"Model path created\")\nif not os.path.exists(PICKLE_DIR):\n    os.makedirs(PICKLE_DIR)\nif not os.path.exists(CSV_DIR):\n    os.makedirs(CSV_DIR)","metadata":{"execution":{"iopub.status.busy":"2023-04-01T12:19:59.654359Z","iopub.execute_input":"2023-04-01T12:19:59.655447Z","iopub.status.idle":"2023-04-01T12:19:59.662661Z","shell.execute_reply.started":"2023-04-01T12:19:59.655376Z","shell.execute_reply":"2023-04-01T12:19:59.661467Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Setting the data augmentation definition\n\ngen_per_image = 1\ngen_per_class = 200\nrotation_range = 5\nwidth_shift_range = 0.02\nheight_shift_range = 0.02\nshear_range = 0.01\nzoom_range = 0.05\nhorizontal_flip = False\nfill_mode = \"nearest\"","metadata":{"execution":{"iopub.status.busy":"2023-04-01T12:20:02.636614Z","iopub.execute_input":"2023-04-01T12:20:02.637008Z","iopub.status.idle":"2023-04-01T12:20:02.643091Z","shell.execute_reply.started":"2023-04-01T12:20:02.636972Z","shell.execute_reply":"2023-04-01T12:20:02.641877Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nheight_shift_range = 0.02\nshear_range = 0.01\nzoom_range = 0.05\nhorizontal_flip = False\nfill_mode = \"nearest\"\n\ndef increase_brightness(img, value):\n    hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)\n    h, s, v = cv2.split(hsv)\n\n    lim = 255 - value\n    v[v > lim] = 255\n    v[v <= lim] += value\n\n    final_hsv = cv2.merge((h, s, v))\n    img = cv2.cvtColor(final_hsv, cv2.COLOR_HSV2BGR)\n    return img\n\ndef change_contrast(img, level):\n    img = Image.fromarray(img.astype('uint8'))\n    factor = (259 * (level + 255)) / (255 * (259 - level))\n    def contrast(c):\n        return 128 + factor * (c - 128)\n    return np.array(img.point(contrast))\n\ndef pad_img(img):\n    h, w = img.shape[:2]\n    new_h = int((5 + secrets.randbelow(16)) * h / 100) + h\n    new_w = int((5 + secrets.randbelow(16)) * w / 100) + w\n\n    full_sheet = np.ones((new_h, new_w, 3)) * 255\n\n    p_X = secrets.randbelow(new_h - img.shape[0])\n    p_Y = secrets.randbelow(new_w - img.shape[1])\n\n    full_sheet[p_X : p_X + img.shape[0], p_Y : p_Y + img.shape[1]] = img\n\n    full_sheet = cv2.resize(full_sheet, (w, h), interpolation = cv2.INTER_AREA)\n\n    return full_sheet.astype(np.uint8)\n\ndef preprocess_img(img):\n    img = np.array(img)\n\n    x = secrets.randbelow(2)\n\n    if x == 0:\n        # img = pad_img(img)\n        img = increase_brightness(img, secrets.randbelow(26))\n        img = change_contrast(img, secrets.randbelow(51))\n    else:\n        # img = pad_img(img)\n        img = change_contrast(img, secrets.randbelow(51))\n        img = increase_brightness(img, secrets.randbelow(26))\n\n    return img\n","metadata":{"execution":{"iopub.status.busy":"2023-04-01T12:20:05.077064Z","iopub.execute_input":"2023-04-01T12:20:05.078025Z","iopub.status.idle":"2023-04-01T12:20:05.092088Z","shell.execute_reply.started":"2023-04-01T12:20:05.07797Z","shell.execute_reply":"2023-04-01T12:20:05.090943Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"BATCH_SIZE = 128\nIMAGE_SIZE = 224\nNUM_EPOCH = 5","metadata":{"execution":{"iopub.status.busy":"2023-04-01T12:20:11.442999Z","iopub.execute_input":"2023-04-01T12:20:11.443363Z","iopub.status.idle":"2023-04-01T12:20:11.448786Z","shell.execute_reply.started":"2023-04-01T12:20:11.443331Z","shell.execute_reply":"2023-04-01T12:20:11.447422Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Initialise the parameters for Augmentation.\ndatagen = ImageDataGenerator(\n        rotation_range = rotation_range,\n        width_shift_range = width_shift_range,\n        height_shift_range = height_shift_range,\n        shear_range = shear_range,\n        zoom_range = zoom_range,\n        horizontal_flip = horizontal_flip,\n        fill_mode = fill_mode,\n        validation_split = 0.2,\n        preprocessing_function = preprocess_img)\n\n\ntrain_data = datagen.flow_from_directory(TRAIN_DIR,\n                                        target_size=(IMAGE_SIZE,IMAGE_SIZE),\n                                        batch_size=BATCH_SIZE,\n                                        subset='training',shuffle=False)\n\nvalid_data = datagen.flow_from_directory(TRAIN_DIR,\n                                        target_size=(IMAGE_SIZE,IMAGE_SIZE),\n                                        batch_size=BATCH_SIZE,\n                                        subset='validation',shuffle=False)","metadata":{"execution":{"iopub.status.busy":"2023-04-01T12:20:14.050241Z","iopub.execute_input":"2023-04-01T12:20:14.050649Z","iopub.status.idle":"2023-04-01T12:20:35.516847Z","shell.execute_reply.started":"2023-04-01T12:20:14.050615Z","shell.execute_reply":"2023-04-01T12:20:35.515743Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Defining Model","metadata":{}},{"cell_type":"code","source":"def get_compiled_model():\n    model = Sequential()\n\n    model.add(Conv2D(filters=64, kernel_size=2, padding='same', activation='relu', input_shape=(IMAGE_SIZE,IMAGE_SIZE,3), kernel_initializer='glorot_normal'))\n    model.add(MaxPooling2D(pool_size=2))\n    model.add(Conv2D(filters=128, kernel_size=2, padding='same', activation='relu', kernel_initializer='glorot_normal'))\n    model.add(MaxPooling2D(pool_size=2))\n    model.add(Conv2D(filters=256, kernel_size=2, padding='same', activation='relu', kernel_initializer='glorot_normal'))\n    model.add(MaxPooling2D(pool_size=2))\n    model.add(Conv2D(filters=512, kernel_size=2, padding='same', activation='relu', kernel_initializer='glorot_normal'))\n    model.add(MaxPooling2D(pool_size=2))\n    model.add(Dropout(0.5))\n    model.add(Flatten())\n    model.add(Dense(500, activation='relu', kernel_initializer='glorot_normal'))\n    model.add(Dropout(0.5))\n    model.add(Dense(10, activation='softmax', kernel_initializer='glorot_normal'))\n\n    model.summary()\n    \n    model.compile(optimizer='rmsprop', loss='categorical_crossentropy', metrics=['accuracy'])\n    \n    return model","metadata":{"execution":{"iopub.status.busy":"2023-04-01T12:20:42.662353Z","iopub.execute_input":"2023-04-01T12:20:42.662726Z","iopub.status.idle":"2023-04-01T12:20:42.673921Z","shell.execute_reply.started":"2023-04-01T12:20:42.662693Z","shell.execute_reply":"2023-04-01T12:20:42.671357Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import tensorflow as tf","metadata":{"execution":{"iopub.status.busy":"2023-04-01T12:18:02.118088Z","iopub.execute_input":"2023-04-01T12:18:02.119053Z","iopub.status.idle":"2023-04-01T12:18:02.124683Z","shell.execute_reply.started":"2023-04-01T12:18:02.118997Z","shell.execute_reply":"2023-04-01T12:18:02.123522Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Create a MirroredStrategy.\nstrategy = tf.distribute.MirroredStrategy()\nprint(\"Number of devices: {}\".format(strategy.num_replicas_in_sync))\n\n# Open a strategy scope.\nwith strategy.scope():\n    # Everything that creates variables should be under the strategy scope.\n    # In general this is only model construction & `compile()`.\n    model = get_compiled_model()","metadata":{"execution":{"iopub.status.busy":"2023-04-01T12:20:49.397445Z","iopub.execute_input":"2023-04-01T12:20:49.397821Z","iopub.status.idle":"2023-04-01T12:20:49.764878Z","shell.execute_reply.started":"2023-04-01T12:20:49.397787Z","shell.execute_reply":"2023-04-01T12:20:49.76389Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"filepath = os.path.join(MODEL_PATH,\"distracted-{epoch:02d}-{val_accuracy:.2f}.hdf5\")\ncheckpoint = ModelCheckpoint(filepath, monitor='val_accuracy', verbose=1, save_best_only=True, mode='max')\ncallbacks_list = [checkpoint]","metadata":{"execution":{"iopub.status.busy":"2023-04-01T12:21:31.415658Z","iopub.execute_input":"2023-04-01T12:21:31.416482Z","iopub.status.idle":"2023-04-01T12:21:31.422071Z","shell.execute_reply.started":"2023-04-01T12:21:31.416441Z","shell.execute_reply":"2023-04-01T12:21:31.420909Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model_history = model.fit(train_data,validation_data = valid_data,epochs=NUM_EPOCH,shuffle=True,callbacks=callbacks_list)","metadata":{"execution":{"iopub.status.busy":"2023-04-01T12:21:35.293167Z","iopub.execute_input":"2023-04-01T12:21:35.293538Z","iopub.status.idle":"2023-04-01T13:00:05.00611Z","shell.execute_reply.started":"2023-04-01T12:21:35.293505Z","shell.execute_reply":"2023-04-01T13:00:05.005059Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(12, 12))\nax1.plot(model_history.history['loss'], color='b', label=\"Training loss\")\nax1.plot(model_history.history['val_loss'], color='r', label=\"validation loss\")\nax1.set_xticks(np.arange(1, 25, 1))\nax1.set_yticks(np.arange(0, 1, 0.1))\n\nax2.plot(model_history.history['accuracy'], color='b', label=\"Training accuracy\")\nax2.plot(model_history.history['val_accuracy'], color='r',label=\"Validation accuracy\")\nax2.set_xticks(np.arange(1, 25, 1))\n\nlegend = plt.legend(loc='best', shadow=True)\nplt.tight_layout()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-04-01T13:02:28.349665Z","iopub.execute_input":"2023-04-01T13:02:28.350923Z","iopub.status.idle":"2023-04-01T13:02:28.912444Z","shell.execute_reply.started":"2023-04-01T13:02:28.350864Z","shell.execute_reply":"2023-04-01T13:02:28.911201Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def print_confusion_matrix(confusion_matrix, class_names, figsize = (10,7), fontsize=14):\n    df_cm = pd.DataFrame(\n        confusion_matrix, index=class_names, columns=class_names, \n    )\n    fig = plt.figure(figsize=figsize)\n    try:\n        heatmap = sns.heatmap(df_cm, annot=True, fmt=\"d\")\n    except ValueError:\n        raise ValueError(\"Confusion matrix values must be integers.\")\n    heatmap.yaxis.set_ticklabels(heatmap.yaxis.get_ticklabels(), rotation=0, ha='right', fontsize=fontsize)\n    heatmap.xaxis.set_ticklabels(heatmap.xaxis.get_ticklabels(), rotation=45, ha='right', fontsize=fontsize)\n    plt.ylabel('True label')\n    plt.xlabel('Predicted label')\n    fig.savefig(os.path.join(MODEL_PATH,\"confusion_matrix.png\"))\n    return fig","metadata":{"execution":{"iopub.status.busy":"2023-04-01T13:03:42.30014Z","iopub.execute_input":"2023-04-01T13:03:42.301104Z","iopub.status.idle":"2023-04-01T13:03:42.309906Z","shell.execute_reply.started":"2023-04-01T13:03:42.30105Z","shell.execute_reply":"2023-04-01T13:03:42.308843Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def print_heatmap(n_labels, n_predictions, class_names):\n    labels = n_labels #sess.run(tf.argmax(n_labels, 1))\n    predictions = n_predictions #sess.run(tf.argmax(n_predictions, 1))\n\n#     confusion_matrix = sess.run(tf.contrib.metrics.confusion_matrix(labels, predictions))\n    matrix = confusion_matrix(labels,predictions.argmax(axis=1))\n    row_sum = np.sum(matrix, axis = 1)\n    w, h = matrix.shape\n\n    c_m = np.zeros((w, h))\n\n    for i in range(h):\n        c_m[i] = matrix[i] * 100 / row_sum[i]\n\n    c = c_m.astype(dtype = np.uint8)\n\n    \n    heatmap = print_confusion_matrix(c, class_names, figsize=(18,10), fontsize=20)\n","metadata":{"execution":{"iopub.status.busy":"2023-04-01T13:03:43.557358Z","iopub.execute_input":"2023-04-01T13:03:43.55829Z","iopub.status.idle":"2023-04-01T13:03:43.565858Z","shell.execute_reply.started":"2023-04-01T13:03:43.558238Z","shell.execute_reply":"2023-04-01T13:03:43.564575Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ypred = model.predict(valid_data)\n\nvalid_list = valid_data.classes.tolist()\n\nypred_class = np.argmax(ypred,axis=1)\nytest = valid_list","metadata":{"execution":{"iopub.status.busy":"2023-04-01T13:03:55.49542Z","iopub.execute_input":"2023-04-01T13:03:55.496481Z","iopub.status.idle":"2023-04-01T13:05:16.162112Z","shell.execute_reply.started":"2023-04-01T13:03:55.496438Z","shell.execute_reply":"2023-04-01T13:05:16.161043Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class_names = list()\nfor name,idx in valid_data.class_indices.items():\n    class_names.append(name)\nprint(class_names)","metadata":{"execution":{"iopub.status.busy":"2023-04-01T13:05:16.165653Z","iopub.execute_input":"2023-04-01T13:05:16.165972Z","iopub.status.idle":"2023-04-01T13:05:16.172127Z","shell.execute_reply.started":"2023-04-01T13:05:16.165943Z","shell.execute_reply":"2023-04-01T13:05:16.170929Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print_heatmap(ytest,ypred,class_names)","metadata":{"execution":{"iopub.status.busy":"2023-04-01T13:05:16.173601Z","iopub.execute_input":"2023-04-01T13:05:16.174494Z","iopub.status.idle":"2023-04-01T13:05:17.118456Z","shell.execute_reply.started":"2023-04-01T13:05:16.174453Z","shell.execute_reply":"2023-04-01T13:05:17.117414Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"accuracy = accuracy_score(ytest,ypred_class)\nprint('Accuracy: %f' % accuracy)\n# precision tp / (tp + fp)\nprecision = precision_score(ytest, ypred_class,average='weighted')\nprint('Precision: %f' % precision)\n# recall: tp / (tp + fn)\nrecall = recall_score(ytest,ypred_class,average='weighted')\nprint('Recall: %f' % recall)\n# f1: 2 tp / (2 tp + fp + fn)\nf1 = f1_score(ytest,ypred_class,average='weighted')\nprint('F1 score: %f' % f1)","metadata":{"execution":{"iopub.status.busy":"2023-04-01T13:05:17.120469Z","iopub.execute_input":"2023-04-01T13:05:17.120765Z","iopub.status.idle":"2023-04-01T13:05:17.144813Z","shell.execute_reply.started":"2023-04-01T13:05:17.120737Z","shell.execute_reply":"2023-04-01T13:05:17.143885Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.evaluate(valid_data)","metadata":{"execution":{"iopub.status.busy":"2023-04-01T13:05:17.146109Z","iopub.execute_input":"2023-04-01T13:05:17.146456Z","iopub.status.idle":"2023-04-01T13:06:36.014039Z","shell.execute_reply.started":"2023-04-01T13:05:17.146421Z","shell.execute_reply":"2023-04-01T13:06:36.013077Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}