{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "scientific-peace",
   "metadata": {},
   "outputs": [],
   "source": [
    "from library.exercise import Exercise\n",
    "from library.dataset import DataSet, TrainTestData\n",
    "from library.GanExamples import StupidToyListGan\n",
    "from library.SimpleGan import SimpleGan"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "optimum-intake",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import random\n",
    "from imblearn.datasets import fetch_datasets"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "average-grocery",
   "metadata": {},
   "source": [
    "# Load the dataset."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "stuffed-picking",
   "metadata": {},
   "outputs": [],
   "source": [
    "datasetName = \"yeast_me2\"\n",
    "\n",
    "def loadDataset():\n",
    "    data = fetch_datasets()['yeast_me2']\n",
    "    labels = data.target\n",
    "    features = data.data\n",
    "    label_1 = list(np.where(labels == 1)[0])\n",
    "    label_0 = list(np.where(labels == -1)[0])\n",
    "    features_1 = features[label_1]\n",
    "    features_0 = features[label_0]\n",
    "    \n",
    "    data0 = np.array(range(100)).reshape((25,4))\n",
    "    return DataSet(data0=features_0, data1=features_1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "hollow-intensity",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = loadDataset()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "excellent-garage",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1433, 8)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.data0.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "timely-magazine",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(51, 8)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.data1.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "intended-oregon",
   "metadata": {},
   "source": [
    "# Initialize the random number generator"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "healthy-secretariat",
   "metadata": {},
   "outputs": [],
   "source": [
    "def getRandGen(initValue, incValue=257, multValue=101, modulus=65537):\n",
    "    value = initValue\n",
    "    while True:\n",
    "        value = ((multValue * value) + incValue) % modulus\n",
    "        yield value\n",
    "            \n",
    "randGen = getRandGen(2021)\n",
    "random.seed(2021)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "future-family",
   "metadata": {},
   "source": [
    "# Create a shuffle function using the random number generator"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "lasting-button",
   "metadata": {},
   "outputs": [],
   "source": [
    "def shuffler(data):\n",
    "    data = list(data)\n",
    "    size = len(data)\n",
    "    shuffled = []\n",
    "    while size > 0:\n",
    "        p = next(randGen) % size\n",
    "        size -= 1\n",
    "        shuffled.append(data[p])\n",
    "        data = data[0:p] + data[(p + 1):]\n",
    "    return np.array(shuffled)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "sensitive-harvard",
   "metadata": {},
   "source": [
    "# Create the Generative Adversarial Network."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "civilian-forty",
   "metadata": {},
   "outputs": [],
   "source": [
    "ganName = \"SimpleGAN\"\n",
    "gan = SimpleGan(numOfFeatures=data.data1.shape[1])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "korean-neighbor",
   "metadata": {},
   "source": [
    "# Test the Network with the loaded data."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "listed-siemens",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-> Shuffling data\n",
      "### Start exercise for synthetic point generator\n",
      "\n",
      "====== Step 1/2 =======\n",
      "-> Shuffling data\n",
      "-> Spliting data to slices\n",
      "\n",
      "------ Step 1/2: Slice 1/2 -------\n",
      "-> Reset the GAN\n",
      "-> Train generator for synthetic samples\n",
      "Epoch 1/3\n",
      "Epoch 2/3\n",
      "Epoch 3/3\n",
      "-> create 691 synthetic samples\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 16968 characters]\n",
      "text/plain": [
       "<Figure size 360x360 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-> test with 'LR'\n",
      "LR tn, fp: 710, 3\n",
      "LR fn, tp: 23, 3LR f1 score: 0.167\n",
      "LR balanced accuracy: 0.553\n",
      "LR cohens kappa score: 0.150\n",
      "LR average precision score: 0.310\n",
      "\n",
      "-> test with 'SVM'\n",
      "SVM tn, fp: 717, 0\n",
      "SVM fn, tp: 26, 0SVM f1 score: 0.000\n",
      "SVM balanced accuracy: 0.500\n",
      "SVM cohens kappa score: 0.000\n",
      "\n",
      "-> test with 'GB'\n",
      "GB tn, fp: 709, 6\n",
      "GB fn, tp: 20, 6GB f1 score: 0.300\n",
      "GB balanced accuracy: 0.610\n",
      "GB cohens kappa score: 0.282\n",
      "\n",
      "-> test with 'KNN'\n",
      "KNN tn, fp: 717, 1\n",
      "KNN fn, tp: 25, 1KNN f1 score: 0.074\n",
      "KNN balanced accuracy: 0.519\n",
      "KNN cohens kappa score: 0.072\n",
      "\n",
      "\n",
      "------ Step 1/2: Slice 2/2 -------\n",
      "-> Reset the GAN\n",
      "-> Train generator for synthetic samples\n",
      "Epoch 1/3\n",
      "Epoch 2/3\n",
      "Epoch 3/3\n",
      "-> create 691 synthetic samples\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 24320 characters]\n",
      "text/plain": [
       "<Figure size 360x360 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-> test with 'LR'\n",
      "LR tn, fp: 709, 6\n",
      "LR fn, tp: 19, 6LR f1 score: 0.316\n",
      "LR balanced accuracy: 0.615\n",
      "LR cohens kappa score: 0.300\n",
      "LR average precision score: 0.281\n",
      "\n",
      "-> test with 'SVM'\n",
      "SVM tn, fp: 716, 0\n",
      "SVM fn, tp: 25, 0SVM f1 score: 0.000\n",
      "SVM balanced accuracy: 0.500\n",
      "SVM cohens kappa score: 0.000\n",
      "\n",
      "-> test with 'GB'\n",
      "GB tn, fp: 713, 6\n",
      "GB fn, tp: 19, 6GB f1 score: 0.353\n",
      "GB balanced accuracy: 0.618\n",
      "GB cohens kappa score: 0.341\n",
      "\n",
      "-> test with 'KNN'\n",
      "KNN tn, fp: 716, 0\n",
      "KNN fn, tp: 25, 0KNN f1 score: 0.000\n",
      "KNN balanced accuracy: 0.500\n",
      "KNN cohens kappa score: 0.000\n",
      "\n",
      "\n",
      "====== Step 2/2 =======\n",
      "-> Shuffling data\n",
      "-> Spliting data to slices\n",
      "\n",
      "------ Step 2/2: Slice 1/2 -------\n",
      "-> Reset the GAN\n",
      "-> Train generator for synthetic samples\n",
      "Epoch 1/3\n",
      "Epoch 2/3\n",
      "Epoch 3/3\n",
      "-> create 691 synthetic samples\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 24112 characters]\n",
      "text/plain": [
       "<Figure size 360x360 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-> test with 'LR'\n",
      "LR tn, fp: 704, 7\n",
      "LR fn, tp: 19, 7LR f1 score: 0.304\n",
      "LR balanced accuracy: 0.626\n",
      "LR cohens kappa score: 0.283\n",
      "LR average precision score: 0.302\n",
      "\n",
      "-> test with 'SVM'\n",
      "SVM tn, fp: 717, 0\n",
      "SVM fn, tp: 26, 0SVM f1 score: 0.000\n",
      "SVM balanced accuracy: 0.500\n",
      "SVM cohens kappa score: 0.000\n",
      "\n",
      "-> test with 'GB'\n",
      "GB tn, fp: 703, 10\n",
      "GB fn, tp: 16, 10GB f1 score: 0.400\n",
      "GB balanced accuracy: 0.683\n",
      "GB cohens kappa score: 0.379\n",
      "\n",
      "-> test with 'KNN'\n",
      "KNN tn, fp: 717, 2\n",
      "KNN fn, tp: 24, 2KNN f1 score: 0.143\n",
      "KNN balanced accuracy: 0.538\n",
      "KNN cohens kappa score: 0.139\n",
      "\n",
      "\n",
      "------ Step 2/2: Slice 2/2 -------\n",
      "-> Reset the GAN\n",
      "-> Train generator for synthetic samples\n",
      "Epoch 1/3\n",
      "Epoch 2/3\n",
      "Epoch 3/3\n",
      "-> create 691 synthetic samples\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 22548 characters]\n",
      "text/plain": [
       "<Figure size 360x360 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-> test with 'LR'\n",
      "LR tn, fp: 715, 3\n",
      "LR fn, tp: 22, 3LR f1 score: 0.207\n",
      "LR balanced accuracy: 0.559\n",
      "LR cohens kappa score: 0.199\n",
      "LR average precision score: 0.497\n",
      "\n",
      "-> test with 'SVM'\n",
      "SVM tn, fp: 716, 0\n",
      "SVM fn, tp: 25, 0SVM f1 score: 0.000\n",
      "SVM balanced accuracy: 0.500\n",
      "SVM cohens kappa score: 0.000\n",
      "\n",
      "-> test with 'GB'\n",
      "GB tn, fp: 713, 4\n",
      "GB fn, tp: 21, 4GB f1 score: 0.250\n",
      "GB balanced accuracy: 0.578\n",
      "GB cohens kappa score: 0.239\n",
      "\n",
      "-> test with 'KNN'\n",
      "KNN tn, fp: 716, 0\n",
      "KNN fn, tp: 25, 0KNN f1 score: 0.000\n",
      "KNN balanced accuracy: 0.500\n",
      "KNN cohens kappa score: 0.000\n",
      "\n",
      "### Exercise is done.\n",
      "\n",
      "-----[ LR ]-----\n",
      "maximum:\n",
      "LR tn, fp: 715, 7\n",
      "LR fn, tp: 23, 7LR f1 score: 0.316\n",
      "LR balanced accuracy: 0.626\n",
      "LR cohens kappa score: 0.300\n",
      "LR average precision score: 0.497\n",
      "\n",
      "\n",
      "average:\n",
      "LR tn, fp: 709.5, 4.75\n",
      "LR fn, tp: 20.75, 4.75LR f1 score: 0.248\n",
      "LR balanced accuracy: 0.588\n",
      "LR cohens kappa score: 0.233\n",
      "LR average precision score: 0.348\n",
      "\n",
      "\n",
      "minimum:\n",
      "LR tn, fp: 704, 3\n",
      "LR fn, tp: 19, 3LR f1 score: 0.167\n",
      "LR balanced accuracy: 0.553\n",
      "LR cohens kappa score: 0.150\n",
      "LR average precision score: 0.281\n",
      "\n",
      "\n",
      "-----[ SVM ]-----\n",
      "maximum:\n",
      "SVM tn, fp: 717, 0\n",
      "SVM fn, tp: 26, 0SVM f1 score: 0.000\n",
      "SVM balanced accuracy: 0.500\n",
      "SVM cohens kappa score: 0.000\n",
      "\n",
      "\n",
      "average:\n",
      "SVM tn, fp: 716.5, 0.0\n",
      "SVM fn, tp: 25.5, 0.0SVM f1 score: 0.000\n",
      "SVM balanced accuracy: 0.500\n",
      "SVM cohens kappa score: 0.000\n",
      "\n",
      "\n",
      "minimum:\n",
      "SVM tn, fp: 716, 0\n",
      "SVM fn, tp: 25, 0SVM f1 score: 0.000\n",
      "SVM balanced accuracy: 0.500\n",
      "SVM cohens kappa score: 0.000\n",
      "\n",
      "\n",
      "-----[ GB ]-----\n",
      "maximum:\n",
      "GB tn, fp: 713, 10\n",
      "GB fn, tp: 21, 10GB f1 score: 0.400\n",
      "GB balanced accuracy: 0.683\n",
      "GB cohens kappa score: 0.379\n",
      "\n",
      "\n",
      "average:\n",
      "GB tn, fp: 709.5, 6.5\n",
      "GB fn, tp: 19.0, 6.5GB f1 score: 0.326\n",
      "GB balanced accuracy: 0.622\n",
      "GB cohens kappa score: 0.310\n",
      "\n",
      "\n",
      "minimum:\n",
      "GB tn, fp: 703, 4\n",
      "GB fn, tp: 16, 4GB f1 score: 0.250\n",
      "GB balanced accuracy: 0.578\n",
      "GB cohens kappa score: 0.239\n",
      "\n",
      "\n",
      "-----[ KNN ]-----\n",
      "maximum:\n",
      "KNN tn, fp: 717, 2\n",
      "KNN fn, tp: 25, 2KNN f1 score: 0.143\n",
      "KNN balanced accuracy: 0.538\n",
      "KNN cohens kappa score: 0.139\n",
      "\n",
      "\n",
      "average:\n",
      "KNN tn, fp: 716.5, 0.75\n",
      "KNN fn, tp: 24.75, 0.75KNN f1 score: 0.054\n",
      "KNN balanced accuracy: 0.514\n",
      "KNN cohens kappa score: 0.053\n",
      "\n",
      "\n",
      "minimum:\n",
      "KNN tn, fp: 716, 0\n",
      "KNN fn, tp: 24, 0KNN f1 score: 0.000\n",
      "KNN balanced accuracy: 0.500\n",
      "KNN cohens kappa score: 0.000\n",
      "\n"
     ]
    }
   ],
   "source": [
    "exercise = Exercise(shuffleFunction=shuffler, numOfShuffles=2, numOfSlices=2)\n",
    "exercise.run(gan, data)\n",
    "exercise.saveResultsTo(f\"{datasetName}-{ganName}.csv\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "identical-verification",
   "metadata": {},
   "source": [
    "# Test also with the \"train data repeating\" generator\n",
    "Hope your GAN performes better."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "progressive-activity",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-> Shuffling data\n",
      "### Start exercise for synthetic point generator\n",
      "\n",
      "====== Step 1/2 =======\n",
      "-> Shuffling data\n",
      "-> Spliting data to slices\n",
      "\n",
      "------ Step 1/2: Slice 1/2 -------\n",
      "-> Reset the GAN\n",
      "-> Train generator for synthetic samples\n",
      "-> create 691 synthetic samples\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 20364 characters]\n",
      "text/plain": [
       "<Figure size 360x360 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-> test with 'LR'\n",
      "LR tn, fp: 622, 18\n",
      "LR fn, tp: 8, 18LR f1 score: 0.259\n",
      "LR balanced accuracy: 0.780\n",
      "LR cohens kappa score: 0.214\n",
      "LR average precision score: 0.215\n",
      "\n",
      "-> test with 'SVM'\n",
      "SVM tn, fp: 639, 18\n",
      "SVM fn, tp: 8, 18SVM f1 score: 0.295\n",
      "SVM balanced accuracy: 0.792\n",
      "SVM cohens kappa score: 0.254\n",
      "\n",
      "-> test with 'GB'\n",
      "GB tn, fp: 690, 8\n",
      "GB fn, tp: 18, 8GB f1 score: 0.262\n",
      "GB balanced accuracy: 0.635\n",
      "GB cohens kappa score: 0.231\n",
      "\n",
      "-> test with 'KNN'\n",
      "KNN tn, fp: 662, 14\n",
      "KNN fn, tp: 12, 14KNN f1 score: 0.295\n",
      "KNN balanced accuracy: 0.731\n",
      "KNN cohens kappa score: 0.257\n",
      "\n",
      "\n",
      "------ Step 1/2: Slice 2/2 -------\n",
      "-> Reset the GAN\n",
      "-> Train generator for synthetic samples\n",
      "-> create 691 synthetic samples\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 21220 characters]\n",
      "text/plain": [
       "<Figure size 360x360 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-> test with 'LR'\n",
      "LR tn, fp: 546, 21\n",
      "LR fn, tp: 4, 21LR f1 score: 0.194\n",
      "LR balanced accuracy: 0.801\n",
      "LR cohens kappa score: 0.143\n",
      "LR average precision score: 0.301\n",
      "\n",
      "-> test with 'SVM'\n",
      "SVM tn, fp: 588, 21\n",
      "SVM fn, tp: 4, 21SVM f1 score: 0.241\n",
      "SVM balanced accuracy: 0.831\n",
      "SVM cohens kappa score: 0.195\n",
      "\n",
      "-> test with 'GB'\n",
      "GB tn, fp: 693, 15\n",
      "GB fn, tp: 10, 15GB f1 score: 0.476\n",
      "GB balanced accuracy: 0.784\n",
      "GB cohens kappa score: 0.454\n",
      "\n",
      "-> test with 'KNN'\n",
      "KNN tn, fp: 654, 13\n",
      "KNN fn, tp: 12, 13KNN f1 score: 0.260\n",
      "KNN balanced accuracy: 0.717\n",
      "KNN cohens kappa score: 0.221\n",
      "\n",
      "\n",
      "====== Step 2/2 =======\n",
      "-> Shuffling data\n",
      "-> Spliting data to slices\n",
      "\n",
      "------ Step 2/2: Slice 1/2 -------\n",
      "-> Reset the GAN\n",
      "-> Train generator for synthetic samples\n",
      "-> create 691 synthetic samples\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 20736 characters]\n",
      "text/plain": [
       "<Figure size 360x360 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-> test with 'LR'\n",
      "LR tn, fp: 562, 21\n",
      "LR fn, tp: 5, 21LR f1 score: 0.208\n",
      "LR balanced accuracy: 0.796\n",
      "LR cohens kappa score: 0.156\n",
      "LR average precision score: 0.293\n",
      "\n",
      "-> test with 'SVM'\n",
      "SVM tn, fp: 600, 21\n",
      "SVM fn, tp: 5, 21SVM f1 score: 0.256\n",
      "SVM balanced accuracy: 0.822\n",
      "SVM cohens kappa score: 0.210\n",
      "\n",
      "-> test with 'GB'\n",
      "GB tn, fp: 694, 10\n",
      "GB fn, tp: 16, 10GB f1 score: 0.339\n",
      "GB balanced accuracy: 0.676\n",
      "GB cohens kappa score: 0.312\n",
      "\n",
      "-> test with 'KNN'\n",
      "KNN tn, fp: 663, 12\n",
      "KNN fn, tp: 14, 12KNN f1 score: 0.261\n",
      "KNN balanced accuracy: 0.693\n",
      "KNN cohens kappa score: 0.222\n",
      "\n",
      "\n",
      "------ Step 2/2: Slice 2/2 -------\n",
      "-> Reset the GAN\n",
      "-> Train generator for synthetic samples\n",
      "-> create 691 synthetic samples\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 20720 characters]\n",
      "text/plain": [
       "<Figure size 360x360 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-> test with 'LR'\n",
      "LR tn, fp: 614, 19\n",
      "LR fn, tp: 6, 19LR f1 score: 0.260\n",
      "LR balanced accuracy: 0.809\n",
      "LR cohens kappa score: 0.216\n",
      "LR average precision score: 0.213\n",
      "\n",
      "-> test with 'SVM'\n",
      "SVM tn, fp: 622, 19\n",
      "SVM fn, tp: 6, 19SVM f1 score: 0.275\n",
      "SVM balanced accuracy: 0.814\n",
      "SVM cohens kappa score: 0.233\n",
      "\n",
      "-> test with 'GB'\n",
      "GB tn, fp: 682, 13\n",
      "GB fn, tp: 12, 13GB f1 score: 0.361\n",
      "GB balanced accuracy: 0.736\n",
      "GB cohens kappa score: 0.332\n",
      "\n",
      "-> test with 'KNN'\n",
      "KNN tn, fp: 664, 18\n",
      "KNN fn, tp: 7, 18KNN f1 score: 0.379\n",
      "KNN balanced accuracy: 0.824\n",
      "KNN cohens kappa score: 0.346\n",
      "\n",
      "### Exercise is done.\n",
      "\n",
      "-----[ LR ]-----\n",
      "maximum:\n",
      "LR tn, fp: 622, 21\n",
      "LR fn, tp: 8, 21LR f1 score: 0.260\n",
      "LR balanced accuracy: 0.809\n",
      "LR cohens kappa score: 0.216\n",
      "LR average precision score: 0.301\n",
      "\n",
      "\n",
      "average:\n",
      "LR tn, fp: 586.0, 19.75\n",
      "LR fn, tp: 5.75, 19.75LR f1 score: 0.230\n",
      "LR balanced accuracy: 0.796\n",
      "LR cohens kappa score: 0.183\n",
      "LR average precision score: 0.256\n",
      "\n",
      "\n",
      "minimum:\n",
      "LR tn, fp: 546, 18\n",
      "LR fn, tp: 4, 18LR f1 score: 0.194\n",
      "LR balanced accuracy: 0.780\n",
      "LR cohens kappa score: 0.143\n",
      "LR average precision score: 0.213\n",
      "\n",
      "\n",
      "-----[ SVM ]-----\n",
      "maximum:\n",
      "SVM tn, fp: 639, 21\n",
      "SVM fn, tp: 8, 21SVM f1 score: 0.295\n",
      "SVM balanced accuracy: 0.831\n",
      "SVM cohens kappa score: 0.254\n",
      "\n",
      "\n",
      "average:\n",
      "SVM tn, fp: 612.25, 19.75\n",
      "SVM fn, tp: 5.75, 19.75SVM f1 score: 0.267\n",
      "SVM balanced accuracy: 0.815\n",
      "SVM cohens kappa score: 0.223\n",
      "\n",
      "\n",
      "minimum:\n",
      "SVM tn, fp: 588, 18\n",
      "SVM fn, tp: 4, 18SVM f1 score: 0.241\n",
      "SVM balanced accuracy: 0.792\n",
      "SVM cohens kappa score: 0.195\n",
      "\n",
      "\n",
      "-----[ GB ]-----\n",
      "maximum:\n",
      "GB tn, fp: 694, 15\n",
      "GB fn, tp: 18, 15GB f1 score: 0.476\n",
      "GB balanced accuracy: 0.784\n",
      "GB cohens kappa score: 0.454\n",
      "\n",
      "\n",
      "average:\n",
      "GB tn, fp: 689.75, 11.5\n",
      "GB fn, tp: 14.0, 11.5GB f1 score: 0.360\n",
      "GB balanced accuracy: 0.708\n",
      "GB cohens kappa score: 0.332\n",
      "\n",
      "\n",
      "minimum:\n",
      "GB tn, fp: 682, 8\n",
      "GB fn, tp: 10, 8GB f1 score: 0.262\n",
      "GB balanced accuracy: 0.635\n",
      "GB cohens kappa score: 0.231\n",
      "\n",
      "\n",
      "-----[ KNN ]-----\n",
      "maximum:\n",
      "KNN tn, fp: 664, 18\n",
      "KNN fn, tp: 14, 18KNN f1 score: 0.379\n",
      "KNN balanced accuracy: 0.824\n",
      "KNN cohens kappa score: 0.346\n",
      "\n",
      "\n",
      "average:\n",
      "KNN tn, fp: 660.75, 14.25\n",
      "KNN fn, tp: 11.25, 14.25KNN f1 score: 0.299\n",
      "KNN balanced accuracy: 0.741\n",
      "KNN cohens kappa score: 0.261\n",
      "\n",
      "\n",
      "minimum:\n",
      "KNN tn, fp: 654, 12\n",
      "KNN fn, tp: 7, 12KNN f1 score: 0.260\n",
      "KNN balanced accuracy: 0.693\n",
      "KNN cohens kappa score: 0.221\n",
      "\n"
     ]
    }
   ],
   "source": [
    "toyGan = StupidToyListGan()\n",
    "exercise.run(toyGan, data)\n",
    "exercise.saveResultsTo(f\"{datasetName}-ToyListGan.csv\")"
   ]
  }
 ],
 "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.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
