Skip to content
Snippets Groups Projects
02-DNN-Regression-Premium.ipynb 156 KiB
Newer Older
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
    "<img width=\"800px\" src=\"../fidle/img/00-Fidle-header-01.svg\"></img>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
    "\n",
    "# <!-- TITLE --> [BHP2] - Regression with a Dense Network (DNN) - Advanced code\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
    "  <!-- DESC -->  More advanced example of DNN network code - BHPD dataset\n",
    "  <!-- AUTHOR : Jean-Luc Parouty (CNRS/SIMaP) -->\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
    "\n",
    "## Objectives :\n",
    " - Predicts **housing prices** from a set of house features. \n",
    " - Understanding the principle and the architecture of a regression with a dense neural network with backup and restore of the trained model. \n",
    "\n",
    "The **[Boston Housing Dataset](https://www.cs.toronto.edu/~delve/data/boston/bostonDetail.html)** consists of price of houses in various places in Boston.  \n",
    "Alongside with price, the dataset also provide these information :\n",
    "\n",
    " - CRIM: This is the per capita crime rate by town\n",
    " - ZN: This is the proportion of residential land zoned for lots larger than 25,000 sq.ft\n",
    " - INDUS: This is the proportion of non-retail business acres per town\n",
    " - CHAS: This is the Charles River dummy variable (this is equal to 1 if tract bounds river; 0 otherwise)\n",
    " - NOX: This is the nitric oxides concentration (parts per 10 million)\n",
    " - RM: This is the average number of rooms per dwelling\n",
    " - AGE: This is the proportion of owner-occupied units built prior to 1940\n",
    " - DIS: This is the weighted distances to five Boston employment centers\n",
    " - RAD: This is the index of accessibility to radial highways\n",
    " - TAX: This is the full-value property-tax rate per 10,000 dollars\n",
    " - PTRATIO: This is the pupil-teacher ratio by town\n",
    " - B: This is calculated as 1000(Bk — 0.63)^2, where Bk is the proportion of people of African American descent by town\n",
    " - LSTAT: This is the percentage lower status of the population\n",
    " - MEDV: This is the median value of owner-occupied homes in 1000 dollars\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
    "\n",
    "## What we're going to do :\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
    "\n",
    " - (Retrieve data)\n",
    " - (Preparing the data)\n",
    " - (Build a model)\n",
    " - Train and save the model\n",
    " - Restore saved model\n",
    " - Evaluate the model\n",
    " - Make some predictions\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Step 1 - Import and init"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style>\n",
       "\n",
       "div.warn {    \n",
       "    background-color: #fcf2f2;\n",
       "    border-color: #dFb5b4;\n",
       "    border-left: 5px solid #dfb5b4;\n",
       "    padding: 0.5em;\n",
       "    font-weight: bold;\n",
       "    font-size: 1.1em;;\n",
       "    }\n",
       "\n",
       "\n",
       "\n",
       "div.nota {    \n",
       "    background-color: #DAFFDE;\n",
       "    border-left: 5px solid #92CC99;\n",
       "    padding: 0.5em;\n",
       "    }\n",
       "\n",
       "div.todo:before { content:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1My44OTEyIiBoZWlnaHQ9IjE0My4zOTAyIiB2aWV3Qm94PSIwIDAgNTMuODkxMiAxNDMuMzkwMiI+PHRpdGxlPjAwLUJvYi10b2RvPC90aXRsZT48cGF0aCBkPSJNMjMuNDU2OCwxMTQuMzAxNmExLjgwNjMsMS44MDYzLDAsMSwxLDEuODE1NywxLjgyNEExLjgyMDksMS44MjA5LDAsMCwxLDIzLjQ1NjgsMTE0LjMwMTZabS0xMC42NjEyLDEuODIyQTEuODI3MiwxLjgyNzIsMCwxLDAsMTAuOTgsMTE0LjMsMS44MiwxLjgyLDAsMCwwLDEyLjc5NTYsMTE2LjEyMzZabS03LjcwNyw0LjU4NzR2LTVzLjQ4NjMtOS4xMjIzLDguMDIxNS0xMS45Njc1YTE5LjIwODIsMTkuMjA4MiwwLDAsMSw2LjA0ODYtMS4yNDU0LDE5LjE3NzgsMTkuMTc3OCwwLDAsMSw2LjA0ODcsMS4yNDc1YzcuNTM1MSwyLjgzNDcsOC4wMTc0LDExLjk2NzQsOC4wMTc0LDExLjk2NzR2NS4wMjM0bC4wMDQyLDcuNjgydjIuNGMuMDE2Ny4xOTkyLjAzMzYuMzkyMS4wMzM2LjU4NzEsMCwuMjEzOC0uMDE2OC40MTA5LS4wMzM2LjYzMzJ2LjA1ODdoLS4wMDg0YTguMzcxOSw4LjM3MTksMCwwLDEtNy4zNzM4LDcuNjU0N3MtLjk5NTMsMy42MzgtNi42OTMzLDMuNjM4LTYuNjkzNC0zLjYzOC02LjY5MzQtMy42MzhhOC4zNyw4LjM3LDAsMCwxLTcuMzcxNi03LjY1NDdINS4wODQzdi0uMDU4N2MtLjAxODktLjIyLS4wMjk0LS40MTk0LS4wMjk0LS42MzMyLDAtLjE5MjkuMDE2Ny0uMzgzNy4wMjk0LS41ODcxdi0yLjRtMTguMDkzNy00LjA0YTEuMTU2NSwxLjE1NjUsMCwxLDAtMi4zMTI2LDAsMS4xNTY0LDEuMTU2NCwwLDEsMCwyLjMxMjYsMFptNC4wODM0LDBhMS4xNTk1LDEuMTU5NSwwLDEsMC0xLjE2MzYsMS4xN0ExLjE3NSwxLjE3NSwwLDAsMCwyNy4yNjE0LDEyNC4zNzc5Wk05LjM3MzksMTE0LjYzNWMwLDMuMTA5MywyLjQxMzIsMy4zMSwyLjQxMzIsMy4zMWExMzMuOTI0MywxMzMuOTI0MywwLDAsMCwxNC43MzQ4LDBzMi40MTExLS4xOTI5LDIuNDExMS0zLjMxYTguMDc3Myw4LjA3NzMsMCwwLDAtMi40MTExLTUuNTUxOWMtNC41LTMuNTAzMy05LjkxMjYtMy41MDMzLTE0Ljc0MTEsMEE4LjA4NTEsOC4wODUxLDAsMCwwLDkuMzczOSwxMTQuNjM1WiIgc3R5bGU9ImZpbGw6IzAxMDEwMSIvPjxjaXJjbGUgY3g9IjMzLjE0MzYiIGN5PSIxMjQuNTM0IiByPSIzLjgzNjMiIHN0eWxlPSJmaWxsOiMwMTAxMDEiLz48cmVjdCB4PSIzNS42NjU5IiB5PSIxMTIuOTYyNSIgd2lkdGg9IjIuMDc3IiBoZWlnaHQ9IjEwLjU0NTgiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIxLjYgMjQxLjExMjEpIHJvdGF0ZSgtMTU1Ljc0NikiIHN0eWxlPSJmaWxsOiMwMTAxMDEiLz48Y2lyY2xlIGN4PSIzOC44NzA0IiBjeT0iMTEzLjQyNzkiIHI9IjIuNDA4NSIgc3R5bGU9ImZpbGw6IzAxMDEwMSIvPjxjaXJjbGUgY3g9IjUuMjI0OCIgY3k9IjEyNC41MzQiIHI9IjMuODM2MyIgc3R5bGU9ImZpbGw6IzAxMDEwMSIvPjxyZWN0IHg9IjEuNDE2NCIgeT0iMTI0LjYzMDEiIHdpZHRoPSIyLjA3NyIgaGVpZ2h0PSIxMC41NDU4IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg0LjkwOTcgMjU5LjgwNikgcm90YXRlKC0xODApIiBzdHlsZT0iZmlsbDojMDEwMTAxIi8+PGNpcmNsZSBjeD0iMi40MDkxIiBjeT0iMTM3LjA5OTYiIHI9IjIuNDA4NSIgc3R5bGU9ImZpbGw6IzAxMDEwMSIvPjxwYXRoIGQ9Ik0xOC4wNTExLDEwMC4xMDY2aC0uMDE0NlYxMDIuNjFoMi4zdi0yLjQyNzlhMi40MjI5LDIuNDIyOSwwLDEsMC0yLjI4NTQtLjA3NTVaIiBzdHlsZT0iZmlsbDojMDEwMTAxIi8+PHBhdGggZD0iTTM5LjQyMTQsMjcuMjU4djEuMDVBMTEuOTQ1MiwxMS45NDUyLDAsMCwwLDQ0LjU5NTQsNS43OWEuMjQ0OS4yNDQ5LDAsMCwxLS4wMjM1LS40MjI3TDQ2Ljc1LDMuOTUxNWEuMzg5Mi4zODkyLDAsMCwxLC40MjYyLDAsMTQuODQ0MiwxNC44NDQyLDAsMCwxLTcuNzU0MywyNy4yNTkxdjEuMDY3YS40NS40NSwwLDAsMS0uNzA0Ny4zNzU4bC0zLjg0MTktMi41MWEuNDUuNDUsMCwwLDEsMC0uNzUxNmwzLjg0MTktMi41MWEuNDUuNDUsMCwwLDEsLjY5NDYuMzc1OFpNNDMuMjMsMi41ODkyLDM5LjM4NzguMDc5NGEuNDUuNDUsMCwwLDAtLjcwNDYuMzc1OHYxLjA2N2ExNC44NDQyLDE0Ljg0NDIsMCwwLDAtNy43NTQzLDI3LjI1OTEuMzg5LjM4OSwwLDAsMCwuNDI2MSwwbDIuMTc3Ny0xLjQxOTNhLjI0NS4yNDUsMCwwLDAtLjAyMzUtLjQyMjgsMTEuOTQ1MSwxMS45NDUxLDAsMCwxLDUuMTc0LTIyLjUxNDZ2MS4wNWEuNDUuNDUsMCwwLDAsLjcwNDYuMzc1OGwzLjg1NTMtMi41MWEuNDUuNDUsMCwwLDAsMC0uNzUxNlpNMzkuMDUyMywxNC4yNDU4YTIuMTIwNiwyLjEyMDYsMCwxLDAsMi4xMjA2LDIuMTIwNmgwQTIuMTI0LDIuMTI0LDAsMCwwLDM5LjA1MjMsMTQuMjQ1OFptNi4wNzMyLTQuNzc4MS44MjU0LjgyNTVhMS4wNTY4LDEuMDU2OCwwLDAsMSwuMTE3NSwxLjM0MjFsLS44MDIsMS4xNDQyYTcuMTAxOCw3LjEwMTgsMCwwLDEsLjcxMTQsMS43MTEybDEuMzc1Ny4yNDE2YTEuMDU2OSwxLjA1NjksMCwwLDEsLjg3NTcsMS4wNHYxLjE2NDNhMS4wNTY5LDEuMDU2OSwwLDAsMS0uODc1NywxLjA0bC0xLjM3MjQuMjQxNkE3LjExLDcuMTEsMCwwLDEsNDUuMjcsMTkuOTNsLjgwMTksMS4xNDQyYTEuMDU3LDEuMDU3LDAsMCwxLS4xMTc0LDEuMzQyMmwtLjgyODguODQ4OWExLjA1NywxLjA1NywwLDAsMS0xLjM0MjEuMTE3NGwtMS4xNDQyLS44MDE5YTcuMTMzOCw3LjEzMzgsMCwwLDEtMS43MTEzLjcxMTNsLS4yNDE2LDEuMzcyNGExLjA1NjgsMS4wNTY4LDAsMCwxLTEuMDQuODc1N0gzOC40Njg0YTEuMDU2OCwxLjA1NjgsMCwwLDEtMS4wNC0uODc1N2wtLjI0MTYtMS4zNzI0YTcuMTM1NSw3LjEzNTUsMCwwLDEtMS43MTEzLS43MTEzbC0xLjE0NDEuODAxOWExLjA1NzEsMS4wNTcxLDAsMCwxLTEuMzQyMi0uMTE3NGwtLjgzNTUtLjgyNTVhMS4wNTcsMS4wNTcsMCwwLDEtLjExNzQtMS4zNDIxbC44MDE5LTEuMTQ0MmE3LjEyMSw3LjEyMSwwLDAsMS0uNzExMy0xLjcxMTJsLTEuMzcyNC0uMjQxNmExLjA1NjksMS4wNTY5LDAsMCwxLS44NzU3LTEuMDRWMTUuNzgyNmExLjA1NjksMS4wNTY5LDAsMCwxLC44NzU3LTEuMDRsMS4zNzU3LS4yNDE2YTcuMTEsNy4xMSwwLDAsMSwuNzExNC0xLjcxMTJsLS44MDItMS4xNDQyYTEuMDU3LDEuMDU3LDAsMCwxLC4xMTc1LTEuMzQyMmwuODI1NC0uODI1NEExLjA1NjgsMS4wNTY4LDAsMCwxLDM0LjMyNDUsOS4zNmwxLjE0NDIuODAxOUE3LjEzNTUsNy4xMzU1LDAsMCwxLDM3LjE4LDkuNDUxbC4yNDE2LTEuMzcyNGExLjA1NjgsMS4wNTY4LDAsMCwxLDEuMDQtLjg3NTdoMS4xNjc3YTEuMDU2OSwxLjA1NjksMCwwLDEsMS4wNC44NzU3bC4yNDE2LDEuMzcyNGE3LjEyNSw3LjEyNSwwLDAsMSwxLjcxMTIuNzExM0w0My43NjY2LDkuMzZBMS4wNTY5LDEuMDU2OSwwLDAsMSw0NS4xMjU1LDkuNDY3N1ptLTIuMDMsNi44OTg3QTQuMDQzMyw0LjA0MzMsMCwxLDAsMzkuMDUyMywyMC40MWgwQTQuMDQ2NSw0LjA0NjUsMCwwLDAsNDMuMDk1NSwxNi4zNjY0WiIgc3R5bGU9ImZpbGw6I2UxMjIyOSIvPjxwb2x5Z29uIHBvaW50cz0iMzkuNDEzIDM0Ljc1NyAzOS41MzcgMzQuNzU3IDM5LjY3NSAzNC43NTcgMzkuNjc1IDEwOS41MSAzOS41MzcgMTA5LjUxIDM5LjQxMyAxMDkuNTEgMzkuNDEzIDM0Ljc1NyAzOS40MTMgMzQuNzU3IiBzdHlsZT0iZmlsbDpub25lO3N0cm9rZTojOTk5O3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjEwO3N0cm9rZS13aWR0aDowLjMwODg1NDQ1MDU2MDE2MThweDtmaWxsLXJ1bGU6ZXZlbm9kZCIvPjwvc3ZnPg==);\n",
       "    float:left;\n",
       "    margin-right:20px;\n",
       "    margin-top:-20px;\n",
       "    margin-bottom:20px;\n",
       "}\n",
       "div.todo{\n",
       "    font-weight: bold;\n",
       "    font-size: 1.1em;\n",
       "    margin-top:40px;\n",
       "}\n",
       "div.todo ul{\n",
       "    margin: 0.2em;\n",
       "}\n",
       "div.todo li{\n",
       "    margin-left:60px;\n",
       "    margin-top:0;\n",
       "    margin-bottom:0;\n",
       "}\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "\n",
       "\n",
       "</style>\n",
       "\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "FIDLE 2020 - Practical Work Module\n",
      "Version              : 0.57 DEV\n",
      "Run time             : Wednesday 9 September 2020, 11:00:51\n",
      "TensorFlow version   : 2.2.0\n",
      "Keras version        : 2.3.0-tf\n",
      "Current place        : Fidle at IDRIS\n",
      "Dataset dir          : /gpfswork/rech/mlh/commun/datasets\n",
      "Update keras cache   : Done\n"
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
     ]
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "from tensorflow import keras\n",
    "\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import pandas as pd\n",
    "import os,sys\n",
    "\n",
    "from IPython.display import Markdown\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
    "from importlib import reload\n",
    "\n",
    "sys.path.append('..')\n",
    "import fidle.pwk as ooo\n",
    "\n",
    "place, dataset_dir = ooo.init()"
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Step 2 - Retrieve data\n",
    "\n",
    "### 2.1 - Option 1  : From Keras\n",
    "Boston housing is a famous historic dataset, so we can get it directly from [Keras datasets](https://www.tensorflow.org/api_docs/python/tf/keras/datasets)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
   "metadata": {},
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
   "source": [
    "# (x_train, y_train), (x_test, y_test) = keras.datasets.boston_housing.load_data(test_split=0.2, seed=113)"
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.2 - Option 2 : From a csv file\n",
    "More fun !"
   ]
  },
  {
   "cell_type": "code",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "</style><table id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7\" ><thead>    <tr>        <th class=\"blank level0\" ></th>        <th class=\"col_heading level0 col0\" >crim</th>        <th class=\"col_heading level0 col1\" >zn</th>        <th class=\"col_heading level0 col2\" >indus</th>        <th class=\"col_heading level0 col3\" >chas</th>        <th class=\"col_heading level0 col4\" >nox</th>        <th class=\"col_heading level0 col5\" >rm</th>        <th class=\"col_heading level0 col6\" >age</th>        <th class=\"col_heading level0 col7\" >dis</th>        <th class=\"col_heading level0 col8\" >rad</th>        <th class=\"col_heading level0 col9\" >tax</th>        <th class=\"col_heading level0 col10\" >ptratio</th>        <th class=\"col_heading level0 col11\" >b</th>        <th class=\"col_heading level0 col12\" >lstat</th>        <th class=\"col_heading level0 col13\" >medv</th>    </tr></thead><tbody>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "                <tr>\n",
       "                        <th id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row0_col0\" class=\"data row0 col0\" >0.01</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row0_col1\" class=\"data row0 col1\" >18.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row0_col2\" class=\"data row0 col2\" >2.31</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row0_col3\" class=\"data row0 col3\" >0.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row0_col4\" class=\"data row0 col4\" >0.54</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row0_col5\" class=\"data row0 col5\" >6.58</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row0_col6\" class=\"data row0 col6\" >65.20</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row0_col7\" class=\"data row0 col7\" >4.09</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row0_col8\" class=\"data row0 col8\" >1.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row0_col9\" class=\"data row0 col9\" >296.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row0_col10\" class=\"data row0 col10\" >15.30</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row0_col11\" class=\"data row0 col11\" >396.90</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row0_col12\" class=\"data row0 col12\" >4.98</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row0_col13\" class=\"data row0 col13\" >24.00</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row1_col0\" class=\"data row1 col0\" >0.03</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row1_col1\" class=\"data row1 col1\" >0.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row1_col2\" class=\"data row1 col2\" >7.07</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row1_col3\" class=\"data row1 col3\" >0.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row1_col4\" class=\"data row1 col4\" >0.47</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row1_col5\" class=\"data row1 col5\" >6.42</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row1_col6\" class=\"data row1 col6\" >78.90</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row1_col7\" class=\"data row1 col7\" >4.97</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row1_col8\" class=\"data row1 col8\" >2.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row1_col9\" class=\"data row1 col9\" >242.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row1_col10\" class=\"data row1 col10\" >17.80</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row1_col11\" class=\"data row1 col11\" >396.90</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row1_col12\" class=\"data row1 col12\" >9.14</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row1_col13\" class=\"data row1 col13\" >21.60</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row2_col0\" class=\"data row2 col0\" >0.03</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row2_col1\" class=\"data row2 col1\" >0.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row2_col2\" class=\"data row2 col2\" >7.07</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row2_col3\" class=\"data row2 col3\" >0.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row2_col4\" class=\"data row2 col4\" >0.47</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row2_col5\" class=\"data row2 col5\" >7.18</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row2_col6\" class=\"data row2 col6\" >61.10</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row2_col7\" class=\"data row2 col7\" >4.97</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row2_col8\" class=\"data row2 col8\" >2.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row2_col9\" class=\"data row2 col9\" >242.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row2_col10\" class=\"data row2 col10\" >17.80</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row2_col11\" class=\"data row2 col11\" >392.83</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row2_col12\" class=\"data row2 col12\" >4.03</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row2_col13\" class=\"data row2 col13\" >34.70</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row3_col0\" class=\"data row3 col0\" >0.03</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row3_col1\" class=\"data row3 col1\" >0.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row3_col2\" class=\"data row3 col2\" >2.18</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row3_col3\" class=\"data row3 col3\" >0.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row3_col4\" class=\"data row3 col4\" >0.46</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row3_col5\" class=\"data row3 col5\" >7.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row3_col6\" class=\"data row3 col6\" >45.80</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row3_col7\" class=\"data row3 col7\" >6.06</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row3_col8\" class=\"data row3 col8\" >3.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row3_col9\" class=\"data row3 col9\" >222.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row3_col10\" class=\"data row3 col10\" >18.70</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row3_col11\" class=\"data row3 col11\" >394.63</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row3_col12\" class=\"data row3 col12\" >2.94</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row3_col13\" class=\"data row3 col13\" >33.40</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7level0_row4\" class=\"row_heading level0 row4\" >4</th>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row4_col0\" class=\"data row4 col0\" >0.07</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row4_col1\" class=\"data row4 col1\" >0.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row4_col2\" class=\"data row4 col2\" >2.18</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row4_col3\" class=\"data row4 col3\" >0.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row4_col4\" class=\"data row4 col4\" >0.46</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row4_col5\" class=\"data row4 col5\" >7.15</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row4_col6\" class=\"data row4 col6\" >54.20</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row4_col7\" class=\"data row4 col7\" >6.06</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row4_col8\" class=\"data row4 col8\" >3.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row4_col9\" class=\"data row4 col9\" >222.00</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row4_col10\" class=\"data row4 col10\" >18.70</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row4_col11\" class=\"data row4 col11\" >396.90</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row4_col12\" class=\"data row4 col12\" >5.33</td>\n",
       "                        <td id=\"T_f5e06af6_f27a_11ea_a6e3_0cc47af5c7c7row4_col13\" class=\"data row4 col13\" >36.20</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "    </tbody></table>"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x14ca92742b90>"
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Missing Data :  0   Shape is :  (506, 14)\n"
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
     ]
    }
   ],
   "source": [
    "data = pd.read_csv(f'{dataset_dir}/BHPD/BostonHousing.csv', header=0)\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
    "\n",
    "display(data.head(5).style.format(\"{0:.2f}\"))\n",
    "print('Missing Data : ',data.isna().sum().sum(), '  Shape is : ', data.shape)"
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Step 3 - Preparing the data\n",
    "### 3.1 - Split data\n",
    "We will use 80% of the data for training and 20% for validation.  \n",
    "x will be input data and y the expected output"
   ]
  },
  {
   "cell_type": "code",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Original data shape was :  (506, 14)\n",
      "x_train :  (354, 13) y_train :  (354,)\n",
      "x_test  :  (152, 13) y_test  :  (152,)\n"
     ]
    }
   ],
   "source": [
    "# ---- Split => train, test\n",
    "#\n",
    "data_train = data.sample(frac=0.7, axis=0)\n",
    "data_test  = data.drop(data_train.index)\n",
    "\n",
    "# ---- Split => x,y (medv is price)\n",
    "#\n",
    "x_train = data_train.drop('medv',  axis=1)\n",
    "y_train = data_train['medv']\n",
    "x_test  = data_test.drop('medv',   axis=1)\n",
    "y_test  = data_test['medv']\n",
    "\n",
    "print('Original data shape was : ',data.shape)\n",
    "print('x_train : ',x_train.shape, 'y_train : ',y_train.shape)\n",
    "print('x_test  : ',x_test.shape,  'y_test  : ',y_test.shape)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.2 - Data normalization\n",
    "**Note :** \n",
    " - All input data must be normalized, train and test.  \n",
    " - To do this we will subtract the mean and divide by the standard deviation.  \n",
    " - But test data should not be used in any way, even for normalization.  \n",
    " - The mean and the standard deviation will therefore only be calculated with the train data."
   ]
  },
  {
   "cell_type": "code",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "</style><table id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7\" ><caption>Before normalization :</caption><thead>    <tr>        <th class=\"blank level0\" ></th>        <th class=\"col_heading level0 col0\" >crim</th>        <th class=\"col_heading level0 col1\" >zn</th>        <th class=\"col_heading level0 col2\" >indus</th>        <th class=\"col_heading level0 col3\" >chas</th>        <th class=\"col_heading level0 col4\" >nox</th>        <th class=\"col_heading level0 col5\" >rm</th>        <th class=\"col_heading level0 col6\" >age</th>        <th class=\"col_heading level0 col7\" >dis</th>        <th class=\"col_heading level0 col8\" >rad</th>        <th class=\"col_heading level0 col9\" >tax</th>        <th class=\"col_heading level0 col10\" >ptratio</th>        <th class=\"col_heading level0 col11\" >b</th>        <th class=\"col_heading level0 col12\" >lstat</th>    </tr></thead><tbody>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "                <tr>\n",
       "                        <th id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7level0_row0\" class=\"row_heading level0 row0\" >count</th>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row0_col0\" class=\"data row0 col0\" >354.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row0_col1\" class=\"data row0 col1\" >354.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row0_col2\" class=\"data row0 col2\" >354.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row0_col3\" class=\"data row0 col3\" >354.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row0_col4\" class=\"data row0 col4\" >354.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row0_col5\" class=\"data row0 col5\" >354.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row0_col6\" class=\"data row0 col6\" >354.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row0_col7\" class=\"data row0 col7\" >354.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row0_col8\" class=\"data row0 col8\" >354.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row0_col9\" class=\"data row0 col9\" >354.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row0_col10\" class=\"data row0 col10\" >354.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row0_col11\" class=\"data row0 col11\" >354.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row0_col12\" class=\"data row0 col12\" >354.00</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7level0_row1\" class=\"row_heading level0 row1\" >mean</th>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row1_col0\" class=\"data row1 col0\" >3.07</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row1_col1\" class=\"data row1 col1\" >12.53</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row1_col2\" class=\"data row1 col2\" >10.98</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row1_col3\" class=\"data row1 col3\" >0.08</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row1_col4\" class=\"data row1 col4\" >0.55</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row1_col5\" class=\"data row1 col5\" >6.29</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row1_col6\" class=\"data row1 col6\" >67.76</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row1_col7\" class=\"data row1 col7\" >3.89</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row1_col8\" class=\"data row1 col8\" >9.38</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row1_col9\" class=\"data row1 col9\" >404.50</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row1_col10\" class=\"data row1 col10\" >18.44</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row1_col11\" class=\"data row1 col11\" >360.71</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row1_col12\" class=\"data row1 col12\" >12.17</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7level0_row2\" class=\"row_heading level0 row2\" >std</th>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row2_col0\" class=\"data row2 col0\" >6.81</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row2_col1\" class=\"data row2 col1\" >24.87</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row2_col2\" class=\"data row2 col2\" >6.84</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row2_col3\" class=\"data row2 col3\" >0.27</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row2_col4\" class=\"data row2 col4\" >0.12</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row2_col5\" class=\"data row2 col5\" >0.71</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row2_col6\" class=\"data row2 col6\" >28.11</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row2_col7\" class=\"data row2 col7\" >2.17</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row2_col8\" class=\"data row2 col8\" >8.60</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row2_col9\" class=\"data row2 col9\" >167.81</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row2_col10\" class=\"data row2 col10\" >2.15</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row2_col11\" class=\"data row2 col11\" >84.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row2_col12\" class=\"data row2 col12\" >6.72</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7level0_row3\" class=\"row_heading level0 row3\" >min</th>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row3_col0\" class=\"data row3 col0\" >0.01</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row3_col1\" class=\"data row3 col1\" >0.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row3_col2\" class=\"data row3 col2\" >0.46</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row3_col3\" class=\"data row3 col3\" >0.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row3_col4\" class=\"data row3 col4\" >0.39</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row3_col5\" class=\"data row3 col5\" >3.56</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row3_col6\" class=\"data row3 col6\" >2.90</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row3_col7\" class=\"data row3 col7\" >1.13</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row3_col8\" class=\"data row3 col8\" >1.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row3_col9\" class=\"data row3 col9\" >187.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row3_col10\" class=\"data row3 col10\" >12.60</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row3_col11\" class=\"data row3 col11\" >0.32</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row3_col12\" class=\"data row3 col12\" >1.92</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7level0_row4\" class=\"row_heading level0 row4\" >25%</th>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row4_col0\" class=\"data row4 col0\" >0.08</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row4_col1\" class=\"data row4 col1\" >0.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row4_col2\" class=\"data row4 col2\" >5.13</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row4_col3\" class=\"data row4 col3\" >0.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row4_col4\" class=\"data row4 col4\" >0.45</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row4_col5\" class=\"data row4 col5\" >5.89</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row4_col6\" class=\"data row4 col6\" >43.88</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row4_col7\" class=\"data row4 col7\" >2.11</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row4_col8\" class=\"data row4 col8\" >4.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row4_col9\" class=\"data row4 col9\" >277.50</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row4_col10\" class=\"data row4 col10\" >17.40</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row4_col11\" class=\"data row4 col11\" >375.38</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row4_col12\" class=\"data row4 col12\" >6.86</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7level0_row5\" class=\"row_heading level0 row5\" >50%</th>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row5_col0\" class=\"data row5 col0\" >0.23</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row5_col1\" class=\"data row5 col1\" >0.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row5_col2\" class=\"data row5 col2\" >9.12</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row5_col3\" class=\"data row5 col3\" >0.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row5_col4\" class=\"data row5 col4\" >0.53</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row5_col5\" class=\"data row5 col5\" >6.23</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row5_col6\" class=\"data row5 col6\" >74.95</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row5_col7\" class=\"data row5 col7\" >3.27</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row5_col8\" class=\"data row5 col8\" >5.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row5_col9\" class=\"data row5 col9\" >330.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row5_col10\" class=\"data row5 col10\" >19.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row5_col11\" class=\"data row5 col11\" >391.30</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row5_col12\" class=\"data row5 col12\" >10.92</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7level0_row6\" class=\"row_heading level0 row6\" >75%</th>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row6_col0\" class=\"data row6 col0\" >3.08</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row6_col1\" class=\"data row6 col1\" >20.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row6_col2\" class=\"data row6 col2\" >18.10</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row6_col3\" class=\"data row6 col3\" >0.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row6_col4\" class=\"data row6 col4\" >0.62</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row6_col5\" class=\"data row6 col5\" >6.59</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row6_col6\" class=\"data row6 col6\" >93.75</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row6_col7\" class=\"data row6 col7\" >5.40</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row6_col8\" class=\"data row6 col8\" >20.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row6_col9\" class=\"data row6 col9\" >666.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row6_col10\" class=\"data row6 col10\" >20.20</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row6_col11\" class=\"data row6 col11\" >396.23</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row6_col12\" class=\"data row6 col12\" >16.11</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7level0_row7\" class=\"row_heading level0 row7\" >max</th>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row7_col0\" class=\"data row7 col0\" >67.92</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row7_col1\" class=\"data row7 col1\" >100.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row7_col2\" class=\"data row7 col2\" >27.74</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row7_col3\" class=\"data row7 col3\" >1.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row7_col4\" class=\"data row7 col4\" >0.87</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row7_col5\" class=\"data row7 col5\" >8.78</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row7_col6\" class=\"data row7 col6\" >100.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row7_col7\" class=\"data row7 col7\" >12.13</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row7_col8\" class=\"data row7 col8\" >24.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row7_col9\" class=\"data row7 col9\" >711.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row7_col10\" class=\"data row7 col10\" >22.00</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row7_col11\" class=\"data row7 col11\" >396.90</td>\n",
       "                        <td id=\"T_f5e98e2e_f27a_11ea_a6e3_0cc47af5c7c7row7_col12\" class=\"data row7 col12\" >37.97</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "    </tbody></table>"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x14ca97c6d6d0>"
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "</style><table id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7\" ><caption>After normalization :</caption><thead>    <tr>        <th class=\"blank level0\" ></th>        <th class=\"col_heading level0 col0\" >crim</th>        <th class=\"col_heading level0 col1\" >zn</th>        <th class=\"col_heading level0 col2\" >indus</th>        <th class=\"col_heading level0 col3\" >chas</th>        <th class=\"col_heading level0 col4\" >nox</th>        <th class=\"col_heading level0 col5\" >rm</th>        <th class=\"col_heading level0 col6\" >age</th>        <th class=\"col_heading level0 col7\" >dis</th>        <th class=\"col_heading level0 col8\" >rad</th>        <th class=\"col_heading level0 col9\" >tax</th>        <th class=\"col_heading level0 col10\" >ptratio</th>        <th class=\"col_heading level0 col11\" >b</th>        <th class=\"col_heading level0 col12\" >lstat</th>    </tr></thead><tbody>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "                <tr>\n",
       "                        <th id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7level0_row0\" class=\"row_heading level0 row0\" >count</th>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row0_col0\" class=\"data row0 col0\" >354.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row0_col1\" class=\"data row0 col1\" >354.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row0_col2\" class=\"data row0 col2\" >354.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row0_col3\" class=\"data row0 col3\" >354.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row0_col4\" class=\"data row0 col4\" >354.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row0_col5\" class=\"data row0 col5\" >354.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row0_col6\" class=\"data row0 col6\" >354.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row0_col7\" class=\"data row0 col7\" >354.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row0_col8\" class=\"data row0 col8\" >354.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row0_col9\" class=\"data row0 col9\" >354.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row0_col10\" class=\"data row0 col10\" >354.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row0_col11\" class=\"data row0 col11\" >354.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row0_col12\" class=\"data row0 col12\" >354.00</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7level0_row1\" class=\"row_heading level0 row1\" >mean</th>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row1_col0\" class=\"data row1 col0\" >-0.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row1_col1\" class=\"data row1 col1\" >-0.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row1_col2\" class=\"data row1 col2\" >0.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row1_col3\" class=\"data row1 col3\" >0.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row1_col4\" class=\"data row1 col4\" >-0.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row1_col5\" class=\"data row1 col5\" >-0.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row1_col6\" class=\"data row1 col6\" >0.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row1_col7\" class=\"data row1 col7\" >0.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row1_col8\" class=\"data row1 col8\" >0.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row1_col9\" class=\"data row1 col9\" >-0.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row1_col10\" class=\"data row1 col10\" >0.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row1_col11\" class=\"data row1 col11\" >0.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row1_col12\" class=\"data row1 col12\" >0.00</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7level0_row2\" class=\"row_heading level0 row2\" >std</th>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row2_col0\" class=\"data row2 col0\" >1.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row2_col1\" class=\"data row2 col1\" >1.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row2_col2\" class=\"data row2 col2\" >1.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row2_col3\" class=\"data row2 col3\" >1.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row2_col4\" class=\"data row2 col4\" >1.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row2_col5\" class=\"data row2 col5\" >1.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row2_col6\" class=\"data row2 col6\" >1.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row2_col7\" class=\"data row2 col7\" >1.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row2_col8\" class=\"data row2 col8\" >1.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row2_col9\" class=\"data row2 col9\" >1.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row2_col10\" class=\"data row2 col10\" >1.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row2_col11\" class=\"data row2 col11\" >1.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row2_col12\" class=\"data row2 col12\" >1.00</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7level0_row3\" class=\"row_heading level0 row3\" >min</th>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row3_col0\" class=\"data row3 col0\" >-0.45</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row3_col1\" class=\"data row3 col1\" >-0.50</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row3_col2\" class=\"data row3 col2\" >-1.54</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row3_col3\" class=\"data row3 col3\" >-0.29</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row3_col4\" class=\"data row3 col4\" >-1.41</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row3_col5\" class=\"data row3 col5\" >-3.82</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row3_col6\" class=\"data row3 col6\" >-2.31</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row3_col7\" class=\"data row3 col7\" >-1.27</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row3_col8\" class=\"data row3 col8\" >-0.97</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row3_col9\" class=\"data row3 col9\" >-1.30</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row3_col10\" class=\"data row3 col10\" >-2.72</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row3_col11\" class=\"data row3 col11\" >-4.29</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row3_col12\" class=\"data row3 col12\" >-1.52</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7level0_row4\" class=\"row_heading level0 row4\" >25%</th>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row4_col0\" class=\"data row4 col0\" >-0.44</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row4_col1\" class=\"data row4 col1\" >-0.50</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row4_col2\" class=\"data row4 col2\" >-0.86</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row4_col3\" class=\"data row4 col3\" >-0.29</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row4_col4\" class=\"data row4 col4\" >-0.88</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row4_col5\" class=\"data row4 col5\" >-0.56</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row4_col6\" class=\"data row4 col6\" >-0.85</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row4_col7\" class=\"data row4 col7\" >-0.82</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row4_col8\" class=\"data row4 col8\" >-0.63</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row4_col9\" class=\"data row4 col9\" >-0.76</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row4_col10\" class=\"data row4 col10\" >-0.48</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row4_col11\" class=\"data row4 col11\" >0.17</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row4_col12\" class=\"data row4 col12\" >-0.79</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7level0_row5\" class=\"row_heading level0 row5\" >50%</th>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row5_col0\" class=\"data row5 col0\" >-0.42</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row5_col1\" class=\"data row5 col1\" >-0.50</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row5_col2\" class=\"data row5 col2\" >-0.27</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row5_col3\" class=\"data row5 col3\" >-0.29</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row5_col4\" class=\"data row5 col4\" >-0.20</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row5_col5\" class=\"data row5 col5\" >-0.08</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row5_col6\" class=\"data row5 col6\" >0.26</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row5_col7\" class=\"data row5 col7\" >-0.29</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row5_col8\" class=\"data row5 col8\" >-0.51</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row5_col9\" class=\"data row5 col9\" >-0.44</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row5_col10\" class=\"data row5 col10\" >0.26</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row5_col11\" class=\"data row5 col11\" >0.36</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row5_col12\" class=\"data row5 col12\" >-0.19</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7level0_row6\" class=\"row_heading level0 row6\" >75%</th>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row6_col0\" class=\"data row6 col0\" >0.00</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row6_col1\" class=\"data row6 col1\" >0.30</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row6_col2\" class=\"data row6 col2\" >1.04</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row6_col3\" class=\"data row6 col3\" >-0.29</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row6_col4\" class=\"data row6 col4\" >0.61</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row6_col5\" class=\"data row6 col5\" >0.43</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row6_col6\" class=\"data row6 col6\" >0.92</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row6_col7\" class=\"data row6 col7\" >0.70</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row6_col8\" class=\"data row6 col8\" >1.24</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row6_col9\" class=\"data row6 col9\" >1.56</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row6_col10\" class=\"data row6 col10\" >0.82</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row6_col11\" class=\"data row6 col11\" >0.42</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row6_col12\" class=\"data row6 col12\" >0.59</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7level0_row7\" class=\"row_heading level0 row7\" >max</th>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row7_col0\" class=\"data row7 col0\" >9.53</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row7_col1\" class=\"data row7 col1\" >3.52</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row7_col2\" class=\"data row7 col2\" >2.45</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row7_col3\" class=\"data row7 col3\" >3.48</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row7_col4\" class=\"data row7 col4\" >2.69</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row7_col5\" class=\"data row7 col5\" >3.49</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row7_col6\" class=\"data row7 col6\" >1.15</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row7_col7\" class=\"data row7 col7\" >3.79</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row7_col8\" class=\"data row7 col8\" >1.70</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row7_col9\" class=\"data row7 col9\" >1.83</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row7_col10\" class=\"data row7 col10\" >1.66</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row7_col11\" class=\"data row7 col11\" >0.43</td>\n",
       "                        <td id=\"T_f5f2e96a_f27a_11ea_a6e3_0cc47af5c7c7row7_col12\" class=\"data row7 col12\" >3.84</td>\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
       "            </tr>\n",
       "    </tbody></table>"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x14ca0e2831d0>"
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(x_train.describe().style.format(\"{0:.2f}\").set_caption(\"Before normalization :\"))\n",
    "\n",
    "mean = x_train.mean()\n",
    "std  = x_train.std()\n",
    "x_train = (x_train - mean) / std\n",
    "x_test  = (x_test  - mean) / std\n",
    "\n",
    "display(x_train.describe().style.format(\"{0:.2f}\").set_caption(\"After normalization :\"))\n",
    "\n",
    "x_train, y_train = np.array(x_train), np.array(y_train)\n",
    "x_test,  y_test  = np.array(x_test),  np.array(y_test)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Step 4 - Build a model\n",
    "More informations about : \n",
    " - [Optimizer](https://www.tensorflow.org/api_docs/python/tf/keras/optimizers)\n",
    " - [Activation](https://www.tensorflow.org/api_docs/python/tf/keras/activations)\n",
    " - [Loss](https://www.tensorflow.org/api_docs/python/tf/keras/losses)\n",
    " - [Metrics](https://www.tensorflow.org/api_docs/python/tf/keras/metrics)"
   ]
  },
  {
   "cell_type": "code",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
   "metadata": {},
   "outputs": [],
   "source": [
    "  def get_model_v1(shape):\n",
    "    \n",
    "    model = keras.models.Sequential()\n",
    "    model.add(keras.layers.Input(shape, name=\"InputLayer\"))\n",
    "    model.add(keras.layers.Dense(64, activation='relu', name='Dense_n1'))\n",
    "    model.add(keras.layers.Dense(64, activation='relu', name='Dense_n2'))\n",
    "    model.add(keras.layers.Dense(1, name='Output'))\n",
    "    \n",
    "    model.compile(optimizer = 'rmsprop',\n",
    "                  loss      = 'mse',\n",
    "                  metrics   = ['mae', 'mse'] )\n",
    "    return model"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 5 - Train the model\n",
    "### 5.1 - Get it"
   ]
  },
  {
   "cell_type": "code",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Model: \"sequential\"\n",
      "_________________________________________________________________\n",
      "Layer (type)                 Output Shape              Param #   \n",
      "=================================================================\n",
      "Dense_n1 (Dense)             (None, 64)                896       \n",
      "_________________________________________________________________\n",
      "Dense_n2 (Dense)             (None, 64)                4160      \n",
      "_________________________________________________________________\n",
      "Output (Dense)               (None, 1)                 65        \n",
      "=================================================================\n",
      "Total params: 5,121\n",
      "Trainable params: 5,121\n",
      "Non-trainable params: 0\n",
      "_________________________________________________________________\n",
      "Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.\n"
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
     ]
    },
    {
     "data": {
      "text/plain": [
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      ]
     },
     "metadata": {},
     "output_type": "display_data"
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
    }
   ],
   "source": [
    "model=get_model_v1( (13,) )\n",
    "\n",
    "model.summary()\n",
    "img=keras.utils.plot_model( model, to_file='./run/model.png', show_shapes=True, show_layer_names=True, dpi=96)\n",
    "display(img)"
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.2 - Add callback"
   ]
  },
  {
   "cell_type": "code",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
   "metadata": {},
   "outputs": [],
   "source": [
    "os.makedirs('./run/models',   mode=0o750, exist_ok=True)\n",
    "save_dir = \"./run/models/best_model.h5\"\n",
    "\n",
    "savemodel_callback = tf.keras.callbacks.ModelCheckpoint(filepath=save_dir, verbose=0, save_best_only=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.3 - Train it"
   ]
  },
  {
   "cell_type": "code",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/100\n",
      "36/36 [==============================] - 0s 9ms/step - loss: 464.3179 - mae: 19.4903 - mse: 464.3179 - val_loss: 300.5945 - val_mae: 15.0059 - val_mse: 300.5945\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 2/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 210.3516 - mae: 12.0248 - mse: 210.3516 - val_loss: 95.9466 - val_mae: 7.9299 - val_mse: 95.9466\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 3/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 75.3829 - mae: 6.4977 - mse: 75.3829 - val_loss: 45.8770 - val_mae: 5.2594 - val_mse: 45.8770\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 4/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 44.4687 - mae: 4.8343 - mse: 44.4687 - val_loss: 32.0006 - val_mae: 4.3209 - val_mse: 32.0006\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 5/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 31.9091 - mae: 4.0118 - mse: 31.9091 - val_loss: 25.6122 - val_mae: 3.8391 - val_mse: 25.6122\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 6/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 26.1435 - mae: 3.5315 - mse: 26.1435 - val_loss: 22.8504 - val_mae: 3.6086 - val_mse: 22.8504\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 7/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 23.3323 - mae: 3.3236 - mse: 23.3323 - val_loss: 21.7002 - val_mae: 3.4371 - val_mse: 21.7002\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 8/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 21.7261 - mae: 3.1901 - mse: 21.7261 - val_loss: 19.6735 - val_mae: 3.2934 - val_mse: 19.6735\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 9/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 19.9363 - mae: 3.0510 - mse: 19.9363 - val_loss: 18.1420 - val_mae: 3.1370 - val_mse: 18.1420\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 10/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 18.8774 - mae: 2.9149 - mse: 18.8774 - val_loss: 17.7544 - val_mae: 3.1180 - val_mse: 17.7544\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 11/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 17.9721 - mae: 2.8677 - mse: 17.9721 - val_loss: 17.0985 - val_mae: 3.0291 - val_mse: 17.0985\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 12/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 17.1248 - mae: 2.7953 - mse: 17.1248 - val_loss: 15.5980 - val_mae: 2.8878 - val_mse: 15.5980\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 13/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 16.2993 - mae: 2.7175 - mse: 16.2993 - val_loss: 14.1831 - val_mae: 2.7218 - val_mse: 14.1831\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 14/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 15.7511 - mae: 2.6758 - mse: 15.7511 - val_loss: 13.5955 - val_mae: 2.6849 - val_mse: 13.5955\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 15/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 15.2687 - mae: 2.5994 - mse: 15.2687 - val_loss: 13.0800 - val_mae: 2.6282 - val_mse: 13.0800\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 16/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 15.0158 - mae: 2.6073 - mse: 15.0158 - val_loss: 13.5067 - val_mae: 2.6882 - val_mse: 13.5067\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 17/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 14.2024 - mae: 2.5947 - mse: 14.2024 - val_loss: 12.5138 - val_mae: 2.5807 - val_mse: 12.5138\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 18/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 13.8580 - mae: 2.5159 - mse: 13.8580 - val_loss: 12.1462 - val_mae: 2.5519 - val_mse: 12.1462\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 19/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 13.5534 - mae: 2.4544 - mse: 13.5534 - val_loss: 13.2271 - val_mae: 2.6670 - val_mse: 13.2271\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 20/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 13.1601 - mae: 2.4835 - mse: 13.1601 - val_loss: 12.2382 - val_mae: 2.5735 - val_mse: 12.2382\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 21/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 12.8416 - mae: 2.4615 - mse: 12.8416 - val_loss: 11.6524 - val_mae: 2.5474 - val_mse: 11.6524\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 22/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 12.6749 - mae: 2.4223 - mse: 12.6749 - val_loss: 11.5032 - val_mae: 2.4850 - val_mse: 11.5032\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 23/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 12.6816 - mae: 2.4281 - mse: 12.6816 - val_loss: 10.9349 - val_mae: 2.4318 - val_mse: 10.9349\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 24/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 12.3611 - mae: 2.3538 - mse: 12.3611 - val_loss: 11.7561 - val_mae: 2.5131 - val_mse: 11.7561\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 25/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 11.9544 - mae: 2.3524 - mse: 11.9544 - val_loss: 10.4493 - val_mae: 2.4044 - val_mse: 10.4493\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 26/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 11.9029 - mae: 2.3492 - mse: 11.9029 - val_loss: 10.5980 - val_mae: 2.4162 - val_mse: 10.5980\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 27/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 11.6171 - mae: 2.3164 - mse: 11.6171 - val_loss: 11.8736 - val_mae: 2.5398 - val_mse: 11.8736\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 28/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 11.4925 - mae: 2.2617 - mse: 11.4925 - val_loss: 10.5695 - val_mae: 2.4465 - val_mse: 10.5695\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 29/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 11.1286 - mae: 2.2877 - mse: 11.1286 - val_loss: 10.5518 - val_mae: 2.4177 - val_mse: 10.5518\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 30/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 11.0731 - mae: 2.2646 - mse: 11.0731 - val_loss: 10.7282 - val_mae: 2.5008 - val_mse: 10.7282\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 31/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 10.8612 - mae: 2.2716 - mse: 10.8612 - val_loss: 10.4843 - val_mae: 2.4441 - val_mse: 10.4843\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 32/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 10.7246 - mae: 2.2451 - mse: 10.7246 - val_loss: 10.2704 - val_mae: 2.4012 - val_mse: 10.2704\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 33/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 10.2492 - mae: 2.2077 - mse: 10.2492 - val_loss: 11.2221 - val_mae: 2.4831 - val_mse: 11.2221\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 34/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 10.5584 - mae: 2.2630 - mse: 10.5584 - val_loss: 10.1440 - val_mae: 2.3830 - val_mse: 10.1440\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 35/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 10.1813 - mae: 2.2209 - mse: 10.1813 - val_loss: 10.0476 - val_mae: 2.4062 - val_mse: 10.0476\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 36/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 10.1717 - mae: 2.1967 - mse: 10.1717 - val_loss: 10.4632 - val_mae: 2.4100 - val_mse: 10.4632\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 37/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 9.9246 - mae: 2.1798 - mse: 9.9246 - val_loss: 9.9208 - val_mae: 2.3727 - val_mse: 9.9208\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 38/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 9.8159 - mae: 2.1963 - mse: 9.8159 - val_loss: 9.8359 - val_mae: 2.3581 - val_mse: 9.8359\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 39/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 9.6780 - mae: 2.1873 - mse: 9.6780 - val_loss: 9.8701 - val_mae: 2.4062 - val_mse: 9.8701\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 40/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 9.5251 - mae: 2.1342 - mse: 9.5251 - val_loss: 9.6047 - val_mae: 2.3436 - val_mse: 9.6047\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 41/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 9.4746 - mae: 2.1520 - mse: 9.4746 - val_loss: 9.7373 - val_mae: 2.3457 - val_mse: 9.7373\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 42/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 9.3605 - mae: 2.1175 - mse: 9.3605 - val_loss: 9.6054 - val_mae: 2.3524 - val_mse: 9.6054\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 43/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 9.1918 - mae: 2.0797 - mse: 9.1918 - val_loss: 10.9157 - val_mae: 2.5016 - val_mse: 10.9157\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 44/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 9.2843 - mae: 2.1522 - mse: 9.2843 - val_loss: 9.9002 - val_mae: 2.3441 - val_mse: 9.9002\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 45/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 9.0087 - mae: 2.0700 - mse: 9.0087 - val_loss: 10.5514 - val_mae: 2.4250 - val_mse: 10.5514\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 46/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 9.3039 - mae: 2.0954 - mse: 9.3039 - val_loss: 9.4293 - val_mae: 2.3046 - val_mse: 9.4293\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 47/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 8.8293 - mae: 2.0884 - mse: 8.8293 - val_loss: 9.8420 - val_mae: 2.3579 - val_mse: 9.8420\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 48/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 8.4904 - mae: 2.0120 - mse: 8.4904 - val_loss: 10.4072 - val_mae: 2.4245 - val_mse: 10.4072\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 49/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 8.8349 - mae: 2.0911 - mse: 8.8349 - val_loss: 10.0544 - val_mae: 2.3717 - val_mse: 10.0544\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 50/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 8.6408 - mae: 2.0619 - mse: 8.6408 - val_loss: 9.8039 - val_mae: 2.3605 - val_mse: 9.8039\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 51/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 8.4134 - mae: 2.0194 - mse: 8.4134 - val_loss: 10.1903 - val_mae: 2.4832 - val_mse: 10.1903\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 52/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 8.5242 - mae: 2.0351 - mse: 8.5242 - val_loss: 9.9179 - val_mae: 2.3458 - val_mse: 9.9179\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 53/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 8.3565 - mae: 2.0397 - mse: 8.3565 - val_loss: 9.6521 - val_mae: 2.3412 - val_mse: 9.6521\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 54/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 8.2495 - mae: 1.9986 - mse: 8.2495 - val_loss: 9.9712 - val_mae: 2.3574 - val_mse: 9.9712\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 55/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 8.0835 - mae: 2.0002 - mse: 8.0835 - val_loss: 9.4039 - val_mae: 2.2964 - val_mse: 9.4039\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 56/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 8.2084 - mae: 2.0002 - mse: 8.2084 - val_loss: 9.4648 - val_mae: 2.2763 - val_mse: 9.4648\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 57/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 7.9313 - mae: 1.9832 - mse: 7.9313 - val_loss: 9.3518 - val_mae: 2.3142 - val_mse: 9.3518\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 58/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 7.9016 - mae: 1.9883 - mse: 7.9016 - val_loss: 9.5171 - val_mae: 2.2856 - val_mse: 9.5171\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 59/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 7.5397 - mae: 1.9664 - mse: 7.5397 - val_loss: 9.8379 - val_mae: 2.3513 - val_mse: 9.8379\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 60/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 7.7821 - mae: 1.9785 - mse: 7.7821 - val_loss: 10.2346 - val_mae: 2.3923 - val_mse: 10.2346\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 61/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 7.4210 - mae: 1.9411 - mse: 7.4210 - val_loss: 10.6922 - val_mae: 2.4746 - val_mse: 10.6922\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 62/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 7.6971 - mae: 1.9652 - mse: 7.6971 - val_loss: 9.8674 - val_mae: 2.3253 - val_mse: 9.8674\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 63/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 7.3951 - mae: 1.8894 - mse: 7.3951 - val_loss: 10.4463 - val_mae: 2.3428 - val_mse: 10.4463\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 64/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 7.5593 - mae: 1.9750 - mse: 7.5593 - val_loss: 9.6882 - val_mae: 2.3001 - val_mse: 9.6882\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 65/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 7.3326 - mae: 1.9378 - mse: 7.3326 - val_loss: 9.4496 - val_mae: 2.2812 - val_mse: 9.4496\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 66/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 7.3662 - mae: 1.9473 - mse: 7.3662 - val_loss: 9.9898 - val_mae: 2.3405 - val_mse: 9.9898\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 67/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 7.0702 - mae: 1.8791 - mse: 7.0702 - val_loss: 9.5983 - val_mae: 2.3591 - val_mse: 9.5983\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 68/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 7.3172 - mae: 1.8818 - mse: 7.3172 - val_loss: 9.3529 - val_mae: 2.3073 - val_mse: 9.3529\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 69/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 7.0806 - mae: 1.8967 - mse: 7.0806 - val_loss: 9.4295 - val_mae: 2.2528 - val_mse: 9.4295\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 70/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 7.0670 - mae: 1.8803 - mse: 7.0670 - val_loss: 9.4532 - val_mae: 2.2795 - val_mse: 9.4532\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 71/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.8649 - mae: 1.8625 - mse: 6.8649 - val_loss: 9.8749 - val_mae: 2.3351 - val_mse: 9.8749\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 72/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 7.1806 - mae: 1.8766 - mse: 7.1806 - val_loss: 9.2817 - val_mae: 2.2604 - val_mse: 9.2817\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 73/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.5872 - mae: 1.8418 - mse: 6.5872 - val_loss: 10.0303 - val_mae: 2.3655 - val_mse: 10.0303\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 74/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.9548 - mae: 1.8869 - mse: 6.9548 - val_loss: 9.6569 - val_mae: 2.3599 - val_mse: 9.6569\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 75/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.6876 - mae: 1.8333 - mse: 6.6876 - val_loss: 9.7876 - val_mae: 2.3004 - val_mse: 9.7876\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 76/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.5796 - mae: 1.8046 - mse: 6.5796 - val_loss: 10.9338 - val_mae: 2.5001 - val_mse: 10.9338\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 77/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.6413 - mae: 1.8520 - mse: 6.6413 - val_loss: 9.4304 - val_mae: 2.2907 - val_mse: 9.4304\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 78/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.5130 - mae: 1.8083 - mse: 6.5130 - val_loss: 9.6580 - val_mae: 2.2899 - val_mse: 9.6580\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 79/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.6066 - mae: 1.8006 - mse: 6.6066 - val_loss: 9.7482 - val_mae: 2.3357 - val_mse: 9.7482\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 80/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.5883 - mae: 1.8347 - mse: 6.5883 - val_loss: 9.3894 - val_mae: 2.2851 - val_mse: 9.3894\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 81/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.2812 - mae: 1.8058 - mse: 6.2812 - val_loss: 9.6674 - val_mae: 2.2690 - val_mse: 9.6674\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 82/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.1064 - mae: 1.7769 - mse: 6.1064 - val_loss: 10.1801 - val_mae: 2.4166 - val_mse: 10.1801\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 83/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.4294 - mae: 1.8218 - mse: 6.4294 - val_loss: 9.4559 - val_mae: 2.2654 - val_mse: 9.4559\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 84/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.0423 - mae: 1.7521 - mse: 6.0423 - val_loss: 11.2327 - val_mae: 2.5183 - val_mse: 11.2327\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 85/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.1562 - mae: 1.8249 - mse: 6.1562 - val_loss: 9.4051 - val_mae: 2.2513 - val_mse: 9.4051\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 86/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.0152 - mae: 1.7271 - mse: 6.0152 - val_loss: 9.4244 - val_mae: 2.3221 - val_mse: 9.4244\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 87/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.0965 - mae: 1.7570 - mse: 6.0965 - val_loss: 9.6101 - val_mae: 2.2832 - val_mse: 9.6101\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 88/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 6.0068 - mae: 1.7716 - mse: 6.0068 - val_loss: 9.8208 - val_mae: 2.3006 - val_mse: 9.8208\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 89/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 5.7903 - mae: 1.7209 - mse: 5.7903 - val_loss: 9.7818 - val_mae: 2.3172 - val_mse: 9.7818\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 90/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 5.5913 - mae: 1.7205 - mse: 5.5913 - val_loss: 9.6276 - val_mae: 2.3013 - val_mse: 9.6276\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 91/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 5.7449 - mae: 1.7211 - mse: 5.7449 - val_loss: 9.8309 - val_mae: 2.3741 - val_mse: 9.8309\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 92/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 5.8709 - mae: 1.7436 - mse: 5.8709 - val_loss: 9.9179 - val_mae: 2.3221 - val_mse: 9.9179\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 93/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 5.6160 - mae: 1.7221 - mse: 5.6160 - val_loss: 9.6447 - val_mae: 2.3046 - val_mse: 9.6447\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 94/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 5.2876 - mae: 1.6580 - mse: 5.2876 - val_loss: 10.0195 - val_mae: 2.3577 - val_mse: 10.0195\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 95/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 5.4876 - mae: 1.6877 - mse: 5.4876 - val_loss: 9.8938 - val_mae: 2.3708 - val_mse: 9.8938\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 96/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 5.4094 - mae: 1.7069 - mse: 5.4094 - val_loss: 9.5077 - val_mae: 2.2969 - val_mse: 9.5077\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 97/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 5.3092 - mae: 1.6633 - mse: 5.3092 - val_loss: 10.3448 - val_mae: 2.4461 - val_mse: 10.3448\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 98/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 5.1171 - mae: 1.6480 - mse: 5.1171 - val_loss: 9.6940 - val_mae: 2.3112 - val_mse: 9.6940\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 99/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 5.2439 - mae: 1.6578 - mse: 5.2439 - val_loss: 9.7853 - val_mae: 2.3216 - val_mse: 9.7853\n",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
      "Epoch 100/100\n",
      "36/36 [==============================] - 0s 3ms/step - loss: 5.2911 - mae: 1.6699 - mse: 5.2911 - val_loss: 10.9270 - val_mae: 2.4735 - val_mse: 10.9270\n"
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
     ]
    }
   ],
   "source": [
    "history = model.fit(x_train,\n",
    "                    y_train,\n",
    "                    epochs          = 100,\n",
    "                    batch_size      = 10,\n",
    "                    verbose         = 1,\n",
    "                    validation_data = (x_test, y_test),\n",
    "                    callbacks       = [savemodel_callback])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Step 6 - Evaluate\n",
    "### 6.1 - Model evaluation\n",
    "MAE =  Mean Absolute Error (between the labels and predictions)  \n",
    "A mae equal to 3 represents an average error in prediction of $3k."
   ]
  },
  {
   "cell_type": "code",
Jean-Luc Parouty's avatar
Jean-Luc Parouty committed
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [