vgg16_classification_training.ipynb 19.8 KB
Newer Older
Tomas Rokos's avatar
Tomas Rokos committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {},
   "outputs": [],
   "source": [
    "from audio_classification.preprocess import preprocess\n",
    "\n",
    "from sklearn import preprocessing\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.metrics import accuracy_score\n",
    "from sklearn.neighbors import KNeighborsClassifier\n",
    "import os\n",
    "# import umap\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import tensorflow as tf\n",
    "# import tensorflow_addons as tfa\n",
    "from tensorflow import keras\n",
    "from tensorflow.keras import backend as K\n",
    "from tensorflow.keras import Model, Sequential\n",
    "from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping\n",
    "from tensorflow.keras.utils import plot_model\n",
    "from tensorflow.keras.layers import Input, Flatten, ZeroPadding2D, Conv2D, BatchNormalization, Activation, Dense, add, MaxPool2D, Dropout, GlobalMaxPool2D"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {},
   "outputs": [],
   "source": [
    "NUMBER_OF_MFCCS = 13\n",
    "CLIP_SIZE = 1290\n",
    "SAMPLE_SHAPE = (NUMBER_OF_MFCCS, CLIP_SIZE, 1)\n",
    "\n",
    "MODEL_FOLDER = os.path.join('models', 'vgg_classifier')\n",
    "MODEL_PATH = os.path.join(MODEL_FOLDER, 'model.h5')\n",
    "\n",
    "if not os.path.isdir(MODEL_FOLDER):\n",
    "    os.makedirs(MODEL_FOLDER)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Cached features found\n"
     ]
    }
   ],
   "source": [
    "data, similarity = preprocess(NUMBER_OF_MFCCS)\n",
    "\n",
    "le = preprocessing.LabelEncoder()\n",
    "transformed = le.fit_transform(data['label'])\n",
    "l = []\n",
    "for index, row in data.iterrows():\n",
    "    arr = np.load(row['file'])\n",
    "    l.append(arr[:, :CLIP_SIZE])\n",
    "    \n",
    "X = np.expand_dims(np.stack(l), axis=3)\n",
    "y = np.array(transformed)\n",
    "\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, stratify=y, random_state=666)\n",
    "X_train, X_valid, y_train, y_valid = train_test_split(X_train, y_train, stratify=y_train, random_state=666)\n",
    "\n",
    "train_dataset = tf.data.Dataset.from_tensor_slices((X_train, y_train)).batch(32)\n",
    "valid_dataset = tf.data.Dataset.from_tensor_slices((X_valid, y_valid)).batch(8)\n",
    "test_dataset = tf.data.Dataset.from_tensor_slices((X_test, y_test)).batch(8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "metadata": {},
   "outputs": [],
   "source": [
    "model = Sequential()\n",
    "\n",
    "inp = Input(shape=SAMPLE_SHAPE, name='input')\n",
    "model.add(inp)\n",
    "\n",
    "model.add(Conv2D(filters=16,kernel_size=(3,3),padding=\"same\", activation=\"relu\"))\n",
    "model.add(Conv2D(filters=16,kernel_size=(3,3),padding=\"same\", activation=\"relu\"))\n",
    "model.add(MaxPool2D(pool_size=(2,2),strides=(2,2)))\n",
    "\n",
    "model.add(Conv2D(filters=32, kernel_size=(3,3), padding=\"same\", activation=\"relu\"))\n",
    "model.add(Conv2D(filters=32, kernel_size=(3,3), padding=\"same\", activation=\"relu\"))\n",
    "model.add(MaxPool2D(pool_size=(2,2),strides=(2,2)))\n",
    "\n",
    "model.add(Conv2D(filters=64, kernel_size=(3,3), padding=\"same\", activation=\"relu\"))\n",
    "model.add(Conv2D(filters=64, kernel_size=(3,3), padding=\"same\", activation=\"relu\"))\n",
    "model.add(Conv2D(filters=64, kernel_size=(3,3), padding=\"same\", activation=\"relu\"))\n",
    "model.add(MaxPool2D(pool_size=(2,2),strides=(2,2)))\n",
    "\n",
    "model.add(Conv2D(filters=128, kernel_size=(3,3), padding=\"same\", activation=\"relu\"))\n",
    "model.add(Conv2D(filters=128, kernel_size=(3,3), padding=\"same\", activation=\"relu\"))\n",
    "model.add(Conv2D(filters=128, kernel_size=(3,3), padding=\"same\", activation=\"relu\"))\n",
    "model.add(MaxPool2D(pool_size=(2,2),strides=(2,2), padding='same'))\n",
    "\n",
    "model.add(Conv2D(filters=128, kernel_size=(3,3), padding=\"same\", activation=\"relu\"))\n",
    "model.add(Conv2D(filters=128, kernel_size=(3,3), padding=\"same\", activation=\"relu\"))\n",
    "model.add(Conv2D(filters=128, kernel_size=(3,3), padding=\"same\", activation=\"relu\"))\n",
    "model.add(MaxPool2D(pool_size=(2,2),strides=(2,2), padding='same'))\n",
    "\n",
    "model.add(Flatten())\n",
    "\n",
    "# Creating 2 Dense Layers\n",
    "model.add(Dense(128, activation='relu'))\n",
    "model.add(Dropout(0.2))\n",
    "\n",
    "model.add(Dense(128, activation='relu'))\n",
    "model.add(Dropout(0.2))\n",
    "\n",
    "# Creating an output layer\n",
    "model.add(Dense(len(le.classes_), activation='softmax', name='output'))\n",
    "\n",
    "# model = Model(inp, x, name='vgg16_model')\n",
    "model.compile(\n",
    "    optimizer='adam',\n",
    "    loss='sparse_categorical_crossentropy',\n",
    "    metrics=['accuracy']\n",
    ")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 2.2889 - accuracy: 0.1067\n",
      "Epoch 00001: val_accuracy improved from -inf to 0.14500, saving model to models/vgg_classifier/model.h5\n",
      "19/19 [==============================] - 15s 775ms/step - loss: 2.2889 - accuracy: 0.1067 - val_loss: 2.1811 - val_accuracy: 0.1450\n",
      "Epoch 2/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 2.1789 - accuracy: 0.1633\n",
      "Epoch 00002: val_accuracy improved from 0.14500 to 0.18500, saving model to models/vgg_classifier/model.h5\n",
      "19/19 [==============================] - 15s 771ms/step - loss: 2.1789 - accuracy: 0.1633 - val_loss: 2.1663 - val_accuracy: 0.1850\n",
      "Epoch 3/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 2.0645 - accuracy: 0.1983\n",
      "Epoch 00003: val_accuracy improved from 0.18500 to 0.20000, saving model to models/vgg_classifier/model.h5\n",
      "19/19 [==============================] - 15s 766ms/step - loss: 2.0645 - accuracy: 0.1983 - val_loss: 2.0233 - val_accuracy: 0.2000\n",
      "Epoch 4/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.9861 - accuracy: 0.2067\n",
      "Epoch 00004: val_accuracy improved from 0.20000 to 0.21000, saving model to models/vgg_classifier/model.h5\n",
      "19/19 [==============================] - 15s 772ms/step - loss: 1.9861 - accuracy: 0.2067 - val_loss: 1.9877 - val_accuracy: 0.2100\n",
      "Epoch 5/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.9498 - accuracy: 0.2100\n",
      "Epoch 00005: val_accuracy improved from 0.21000 to 0.25500, saving model to models/vgg_classifier/model.h5\n",
      "19/19 [==============================] - 15s 777ms/step - loss: 1.9498 - accuracy: 0.2100 - val_loss: 1.9885 - val_accuracy: 0.2550\n",
      "Epoch 6/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 2.0346 - accuracy: 0.1983\n",
      "Epoch 00006: val_accuracy improved from 0.25500 to 0.29500, saving model to models/vgg_classifier/model.h5\n",
      "19/19 [==============================] - 15s 802ms/step - loss: 2.0346 - accuracy: 0.1983 - val_loss: 1.9624 - val_accuracy: 0.2950\n",
      "Epoch 7/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.9070 - accuracy: 0.2667\n",
      "Epoch 00007: val_accuracy improved from 0.29500 to 0.33000, saving model to models/vgg_classifier/model.h5\n",
      "19/19 [==============================] - 17s 912ms/step - loss: 1.9070 - accuracy: 0.2667 - val_loss: 1.8709 - val_accuracy: 0.3300\n",
      "Epoch 8/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.8339 - accuracy: 0.2917\n",
      "Epoch 00008: val_accuracy did not improve from 0.33000\n",
      "19/19 [==============================] - 21s 1s/step - loss: 1.8339 - accuracy: 0.2917 - val_loss: 1.8414 - val_accuracy: 0.3100\n",
      "Epoch 9/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.7588 - accuracy: 0.3200\n",
      "Epoch 00009: val_accuracy did not improve from 0.33000\n",
      "19/19 [==============================] - 16s 845ms/step - loss: 1.7588 - accuracy: 0.3200 - val_loss: 1.7785 - val_accuracy: 0.3100\n",
      "Epoch 10/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.7542 - accuracy: 0.3200\n",
      "Epoch 00010: val_accuracy improved from 0.33000 to 0.34000, saving model to models/vgg_classifier/model.h5\n",
      "19/19 [==============================] - 15s 813ms/step - loss: 1.7542 - accuracy: 0.3200 - val_loss: 1.7243 - val_accuracy: 0.3400\n",
      "Epoch 11/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.7629 - accuracy: 0.3283\n",
      "Epoch 00011: val_accuracy improved from 0.34000 to 0.37000, saving model to models/vgg_classifier/model.h5\n",
      "19/19 [==============================] - 15s 771ms/step - loss: 1.7629 - accuracy: 0.3283 - val_loss: 1.6976 - val_accuracy: 0.3700\n",
      "Epoch 12/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.5748 - accuracy: 0.3967\n",
      "Epoch 00012: val_accuracy improved from 0.37000 to 0.41000, saving model to models/vgg_classifier/model.h5\n",
      "19/19 [==============================] - 15s 765ms/step - loss: 1.5748 - accuracy: 0.3967 - val_loss: 1.6233 - val_accuracy: 0.4100\n",
      "Epoch 13/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.5898 - accuracy: 0.3917\n",
      "Epoch 00013: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 14s 760ms/step - loss: 1.5898 - accuracy: 0.3917 - val_loss: 1.7127 - val_accuracy: 0.4000\n",
      "Epoch 14/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.5307 - accuracy: 0.4217\n",
      "Epoch 00014: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 14s 760ms/step - loss: 1.5307 - accuracy: 0.4217 - val_loss: 1.6941 - val_accuracy: 0.3950\n",
      "Epoch 15/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.3964 - accuracy: 0.4617\n",
      "Epoch 00015: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 15s 768ms/step - loss: 1.3964 - accuracy: 0.4617 - val_loss: 1.6834 - val_accuracy: 0.3950\n",
      "Epoch 16/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.5606 - accuracy: 0.4317\n",
      "Epoch 00016: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 14s 761ms/step - loss: 1.5606 - accuracy: 0.4317 - val_loss: 1.8977 - val_accuracy: 0.3200\n",
      "Epoch 17/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.5327 - accuracy: 0.4550\n",
      "Epoch 00017: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 15s 767ms/step - loss: 1.5327 - accuracy: 0.4550 - val_loss: 1.9956 - val_accuracy: 0.2650\n",
      "Epoch 18/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.5566 - accuracy: 0.4467\n",
      "Epoch 00018: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 15s 767ms/step - loss: 1.5566 - accuracy: 0.4467 - val_loss: 1.8397 - val_accuracy: 0.2800\n",
      "Epoch 19/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.4566 - accuracy: 0.4867\n",
      "Epoch 00019: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 15s 787ms/step - loss: 1.4566 - accuracy: 0.4867 - val_loss: 2.0173 - val_accuracy: 0.2800\n",
      "Epoch 20/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.4254 - accuracy: 0.4917\n",
      "Epoch 00020: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 14s 759ms/step - loss: 1.4254 - accuracy: 0.4917 - val_loss: 1.8489 - val_accuracy: 0.2900\n",
      "Epoch 21/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.2729 - accuracy: 0.5650\n",
      "Epoch 00021: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 15s 763ms/step - loss: 1.2729 - accuracy: 0.5650 - val_loss: 2.1161 - val_accuracy: 0.2950\n",
      "Epoch 22/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.2143 - accuracy: 0.5667\n",
      "Epoch 00022: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 14s 761ms/step - loss: 1.2143 - accuracy: 0.5667 - val_loss: 1.9431 - val_accuracy: 0.3150\n",
      "Epoch 23/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.0796 - accuracy: 0.5917\n",
      "Epoch 00023: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 15s 777ms/step - loss: 1.0796 - accuracy: 0.5917 - val_loss: 2.6343 - val_accuracy: 0.3100\n",
      "Epoch 24/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.0940 - accuracy: 0.6183\n",
      "Epoch 00024: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 15s 777ms/step - loss: 1.0940 - accuracy: 0.6183 - val_loss: 2.6504 - val_accuracy: 0.2950\n",
      "Epoch 25/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 0.9735 - accuracy: 0.6483\n",
      "Epoch 00025: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 15s 806ms/step - loss: 0.9735 - accuracy: 0.6483 - val_loss: 3.0722 - val_accuracy: 0.3500\n",
      "Epoch 26/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.0476 - accuracy: 0.6617\n",
      "Epoch 00026: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 15s 786ms/step - loss: 1.0476 - accuracy: 0.6617 - val_loss: 2.7793 - val_accuracy: 0.2950\n",
      "Epoch 27/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 1.2422 - accuracy: 0.5533\n",
      "Epoch 00027: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 15s 793ms/step - loss: 1.2422 - accuracy: 0.5533 - val_loss: 2.2228 - val_accuracy: 0.3250\n",
      "Epoch 28/1000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "19/19 [==============================] - ETA: 0s - loss: 0.9301 - accuracy: 0.6717\n",
      "Epoch 00028: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 15s 792ms/step - loss: 0.9301 - accuracy: 0.6717 - val_loss: 2.5772 - val_accuracy: 0.3500\n",
      "Epoch 29/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 0.7298 - accuracy: 0.7200\n",
      "Epoch 00029: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 15s 772ms/step - loss: 0.7298 - accuracy: 0.7200 - val_loss: 3.3550 - val_accuracy: 0.3600\n",
      "Epoch 30/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 0.6593 - accuracy: 0.7733\n",
      "Epoch 00030: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 15s 773ms/step - loss: 0.6593 - accuracy: 0.7733 - val_loss: 2.9248 - val_accuracy: 0.3150\n",
      "Epoch 31/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 0.6442 - accuracy: 0.7683\n",
      "Epoch 00031: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 15s 766ms/step - loss: 0.6442 - accuracy: 0.7683 - val_loss: 2.9083 - val_accuracy: 0.3800\n",
      "Epoch 32/1000\n",
      "19/19 [==============================] - ETA: 0s - loss: 0.5345 - accuracy: 0.8100\n",
      "Epoch 00032: val_accuracy did not improve from 0.41000\n",
      "19/19 [==============================] - 15s 768ms/step - loss: 0.5345 - accuracy: 0.8100 - val_loss: 3.3895 - val_accuracy: 0.3550\n",
      "Epoch 00032: early stopping\n"
     ]
    }
   ],
   "source": [
    "tf.config.run_functions_eagerly(True)\n",
    "history = model.fit(\n",
    "    train_dataset,\n",
    "    validation_data=valid_dataset,\n",
    "    epochs=1000,\n",
    "    callbacks=[\n",
    "        ModelCheckpoint(MODEL_PATH, monitor='val_accuracy', mode='max', verbose=1, save_best_only=True),\n",
    "        EarlyStopping(monitor='val_accuracy', mode='max', verbose=1, patience=20, min_delta=0.01)\n",
    "    ]\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=== TRAIN ===\n",
      "              precision    recall  f1-score   support\n",
      "\n",
      "       blues       0.67      0.10      0.17        60\n",
      "   classical       0.71      0.97      0.82        60\n",
      "     country       0.34      0.37      0.35        60\n",
      "       disco       0.45      0.17      0.24        60\n",
      "      hiphop       0.36      0.15      0.21        60\n",
      "        jazz       0.62      0.22      0.32        60\n",
      "       metal       0.71      0.90      0.79        60\n",
      "         pop       0.34      0.95      0.50        60\n",
      "      reggae       0.33      0.35      0.34        60\n",
      "        rock       0.45      0.50      0.47        60\n",
      "\n",
      "    accuracy                           0.47       600\n",
      "   macro avg       0.50      0.47      0.42       600\n",
      "weighted avg       0.50      0.47      0.42       600\n",
      "\n",
      "=== TEST ===\n",
      "              precision    recall  f1-score   support\n",
      "\n",
      "       blues       0.00      0.00      0.00        20\n",
      "   classical       0.66      0.95      0.78        20\n",
      "     country       0.37      0.35      0.36        20\n",
      "       disco       0.12      0.05      0.07        20\n",
      "      hiphop       0.36      0.20      0.26        20\n",
      "        jazz       0.50      0.15      0.23        20\n",
      "       metal       0.64      0.90      0.75        20\n",
      "         pop       0.25      0.80      0.39        20\n",
      "      reggae       0.05      0.05      0.05        20\n",
      "        rock       0.14      0.10      0.12        20\n",
      "\n",
      "    accuracy                           0.36       200\n",
      "   macro avg       0.31      0.36      0.30       200\n",
      "weighted avg       0.31      0.35      0.30       200\n",
      "\n"
     ]
    }
   ],
   "source": [
    "from sklearn.metrics import classification_report, plot_confusion_matrix\n",
    "\n",
    "model = tf.keras.models.load_model(MODEL_PATH, compile=False)\n",
    "train_predictions = model.predict(X_train).argmax(axis=1)\n",
    "test_predictions = model.predict(X_test).argmax(axis=1)\n",
    "#print(train_predictions.argmax(axis=1).shape)\n",
    "\n",
    "print('=== TRAIN ===')\n",
    "print(classification_report(y_train, train_predictions, target_names=le.classes_))\n",
    "\n",
    "print('=== TEST ===')\n",
    "print(classification_report(y_test, test_predictions, target_names=le.classes_))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}