dataset-1-regression.ipynb 43.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Student Alcohol Consumption\n",
    "\n",
    "WHAT??? \n",
    "\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
11 12 13 14
    "Prédire les notes des étudiants en fonction de facteurs tels que la consommation d'alcool ? \n",
    "PS: peu importe ce qu'on en déduira, pas touche à notre cher... \n",
    "\n",
    "On s'intéresse à un jeu de données social où ont été recueillies des informations sur des lycéens à propos de leurs conditions. Les notes qu'ils ont obtenus à leurs examens sont églament présentes. On voudrait pouvoir prédire les notes obtenues en fonction des conditions sociales des étudiants.\n",
15 16 17 18 19 20 21 22 23 24 25 26 27
    "\n",
    "Plus infos sur le dataset: https://www.kaggle.com/uciml/student-alcohol-consumption/home"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chargement des données"
   ]
  },
  {
   "cell_type": "code",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
28
   "execution_count": 1,
29 30 31 32 33 34 35 36
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(395, 33)"
      ]
     },
Sylvain Marchienne's avatar
Sylvain Marchienne committed
37
     "execution_count": 1,
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import pandas as pd\n",
    "df = pd.read_csv('./student-alcohol-consumption/student-mat.csv')\n",
    "df.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "On a 395 lignes et 33 colonnes. Chaque ligne correspond à un étudiant. Les colonnes sont les variables, elles décrivent les informations à propos de l'étudiant comme son âge, sexe, son temps de transport pour aller à l'école, le temps qu'il travaille à la maison, sa consommation d'alcool, etc. La liste complète de ces variables (les features) et leur explication est disponible ici: https://www.kaggle.com/uciml/student-alcohol-consumption/home"
   ]
  },
  {
   "cell_type": "code",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
58
   "execution_count": 2,
59 60 61 62 63 64 65 66 67 68 69 70 71
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['school', 'sex', 'age', 'address', 'famsize', 'Pstatus', 'Medu', 'Fedu',\n",
       "       'Mjob', 'Fjob', 'reason', 'guardian', 'traveltime', 'studytime',\n",
       "       'failures', 'schoolsup', 'famsup', 'paid', 'activities', 'nursery',\n",
       "       'higher', 'internet', 'romantic', 'famrel', 'freetime', 'goout', 'Dalc',\n",
       "       'Walc', 'health', 'absences', 'G1', 'G2', 'G3'],\n",
       "      dtype='object')"
      ]
     },
Sylvain Marchienne's avatar
Sylvain Marchienne committed
72
     "execution_count": 2,
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "On cherche à prédire quels sont les résultats scolaires des étudiants. Il y a pour chacun 3 notes: G1 (first period grade), G2 (second period grade) et G3 (final grade).\n",
    "\n",
    "Question, est-ce que la consommation d'alcool influe sur le résultat des élèves ? Réponse !"
   ]
  },
  {
   "cell_type": "code",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
92
   "execution_count": 3,
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA6IAAAEdCAYAAAAW+9oOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzt3Xu0ZGV95vHvYzcISkSE9jISbQVRCcplWk0kKqIkGp1gZhKjMYjRhGhGk0xcKmZmFhKXj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qd8j6gkSZIkqVMOopIkSZKkTjmIaqqS/CjJhUkuTXJRkj80B9FLAAABpklEQVRJstO/Z0k2Jrmkq4ySNCm7TtIisOvU0vq+A2hwbq6qwwCS3B14J7A3cFKvqSRpuuw6SYvArlMzroiqmaq6DjgBeH5GNib55yTnj/975PLvSbIuyV8k2ZLk4iQv6D65JK2cXSdpEdh1mjZXRNVUVV0x3sJxd+A64Jiq+n6SBwDvAjYt+5YTGH0m1eFVdWuSu3WbWJJWz66TtAjsOk2Tg6i6kPGvuwFvSHIY8CPgoB089vHAm6rqVoCquqGbiJI0MbtO0iKw6zQVDqJqKsn9GZXTdYzeT/AN4FBG28K/v6NvAfxwW0lzxa6TtAjsOk2T7xFVM0k2AG8C3lBVxejN7ddU1W3AccC6HXzbWcBzk6wf/x5u4ZA00+w6SYvArtO0OYhq2vbcfplv4OOMCujk8X2nAscn+Syj7Rs37eD73wx8Hbg4yUXAb3WQWZJWy66TtAjsOjWT0Q80JEmSJEnqhiuikiRJkqROOYhKkiRJkjrlICpJkiRJ6pSDqCRJkiSpUw6ikiRJkqROOYhKkiRJkjrlICpJkiRJ6pSDqCRJkiSpU/8PZj9pZziTkmkAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 1152x216 with 3 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
Sylvain Marchienne's avatar
Sylvain Marchienne committed
109 110
    "# On affiche pour chaque examen (G1-3) les moyennes des notes selon la catégorie de consommation\n",
    "# d'alcool en semaine (oui, en semaine). Dalc est la variable correspondante (voir la doc)\n",
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
    "fig, axes = plt.subplots(1,3, figsize=(16, 3))\n",
    "for a in [(\"G1\", axes[0]), (\"G2\", axes[1]), (\"G3\", axes[2])]:\n",
    "    df.groupby(pd.cut(df[\"Dalc\"], 3))[a[0]].mean().plot.bar(ax=a[1], title=a[0])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "On se rend compte que NON, ça n'influe pas (presque pas, aller)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Plus sérieusement"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
Sylvain Marchienne's avatar
Sylvain Marchienne committed
135
    "On souhaite toujours prédire la note d'un élève en fonction de toutes les variables à disposition. On choisi de ne garder que la variable G3 pour simplifier le problème. On pourrait aussi faire une moyenne de ces 3 notes. Au choix. G3 sera donc notre variable à prédire (target feature)."
136 137 138 139
   ]
  },
  {
   "cell_type": "code",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
140
   "execution_count": 4,
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['school', 'sex', 'age', 'address', 'famsize', 'Pstatus', 'Medu', 'Fedu',\n",
       "       'Mjob', 'Fjob', 'reason', 'guardian', 'traveltime', 'studytime',\n",
       "       'failures', 'schoolsup', 'famsup', 'paid', 'activities', 'nursery',\n",
       "       'higher', 'internet', 'romantic', 'famrel', 'freetime', 'goout', 'Dalc',\n",
       "       'Walc', 'health', 'absences', 'G3'],\n",
       "      dtype='object')"
      ]
     },
Sylvain Marchienne's avatar
Sylvain Marchienne committed
156
     "execution_count": 4,
157 158 159 160 161 162 163 164 165 166 167
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = df.drop([\"G1\", \"G2\"], axis=1)\n",
    "data.columns"
   ]
  },
  {
   "cell_type": "code",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
168
   "execution_count": 5,
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>school</th>\n",
       "      <th>sex</th>\n",
       "      <th>age</th>\n",
       "      <th>address</th>\n",
       "      <th>famsize</th>\n",
       "      <th>Pstatus</th>\n",
       "      <th>Medu</th>\n",
       "      <th>Fedu</th>\n",
       "      <th>Mjob</th>\n",
       "      <th>Fjob</th>\n",
       "      <th>...</th>\n",
       "      <th>internet</th>\n",
       "      <th>romantic</th>\n",
       "      <th>famrel</th>\n",
       "      <th>freetime</th>\n",
       "      <th>goout</th>\n",
       "      <th>Dalc</th>\n",
       "      <th>Walc</th>\n",
       "      <th>health</th>\n",
       "      <th>absences</th>\n",
       "      <th>G3</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
217
       "      <th>55</th>\n",
218 219
       "      <td>GP</td>\n",
       "      <td>F</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
220 221
       "      <td>16</td>\n",
       "      <td>U</td>\n",
222 223
       "      <td>GT3</td>\n",
       "      <td>A</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
224
       "      <td>2</td>\n",
225
       "      <td>1</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
226 227
       "      <td>other</td>\n",
       "      <td>other</td>\n",
228
       "      <td>...</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
229 230
       "      <td>yes</td>\n",
       "      <td>yes</td>\n",
231 232 233 234 235 236 237
       "      <td>5</td>\n",
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>8</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
238
       "      <td>10</td>\n",
239 240
       "    </tr>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
241 242 243 244
       "      <th>155</th>\n",
       "      <td>GP</td>\n",
       "      <td>M</td>\n",
       "      <td>15</td>\n",
245 246 247 248
       "      <td>R</td>\n",
       "      <td>GT3</td>\n",
       "      <td>T</td>\n",
       "      <td>2</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
249 250
       "      <td>3</td>\n",
       "      <td>at_home</td>\n",
251 252 253 254
       "      <td>services</td>\n",
       "      <td>...</td>\n",
       "      <td>no</td>\n",
       "      <td>no</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
255 256 257 258 259
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
260 261
       "      <td>1</td>\n",
       "      <td>2</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
262
       "      <td>8</td>\n",
263 264
       "    </tr>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
265
       "      <th>151</th>\n",
266
       "      <td>GP</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
267 268
       "      <td>M</td>\n",
       "      <td>16</td>\n",
269 270
       "      <td>U</td>\n",
       "      <td>LE3</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
271 272 273 274
       "      <td>T</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>at_home</td>\n",
275 276
       "      <td>other</td>\n",
       "      <td>...</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
277
       "      <td>no</td>\n",
278 279 280 281
       "      <td>yes</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
282 283 284 285
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>6</td>\n",
286 287 288
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
289
       "      <th>82</th>\n",
290
       "      <td>GP</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
291 292 293 294
       "      <td>F</td>\n",
       "      <td>15</td>\n",
       "      <td>U</td>\n",
       "      <td>LE3</td>\n",
295
       "      <td>T</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
296
       "      <td>3</td>\n",
297
       "      <td>2</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
298
       "      <td>services</td>\n",
299 300 301 302 303 304 305
       "      <td>other</td>\n",
       "      <td>...</td>\n",
       "      <td>yes</td>\n",
       "      <td>no</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
306 307
       "      <td>1</td>\n",
       "      <td>1</td>\n",
308
       "      <td>5</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
309 310
       "      <td>10</td>\n",
       "      <td>6</td>\n",
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>GP</td>\n",
       "      <td>F</td>\n",
       "      <td>15</td>\n",
       "      <td>R</td>\n",
       "      <td>GT3</td>\n",
       "      <td>T</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>services</td>\n",
       "      <td>health</td>\n",
       "      <td>...</td>\n",
       "      <td>yes</td>\n",
       "      <td>no</td>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>2</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
337
       "      <th>18</th>\n",
338
       "      <td>GP</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
339
       "      <td>M</td>\n",
340 341 342 343 344
       "      <td>17</td>\n",
       "      <td>U</td>\n",
       "      <td>GT3</td>\n",
       "      <td>T</td>\n",
       "      <td>3</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
345
       "      <td>2</td>\n",
346 347 348 349 350
       "      <td>services</td>\n",
       "      <td>services</td>\n",
       "      <td>...</td>\n",
       "      <td>yes</td>\n",
       "      <td>no</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
351 352 353
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
354
       "      <td>2</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
355 356 357
       "      <td>4</td>\n",
       "      <td>5</td>\n",
       "      <td>16</td>\n",
358 359 360
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
361
       "      <th>75</th>\n",
362
       "      <td>GP</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
363
       "      <td>M</td>\n",
364
       "      <td>15</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
365 366
       "      <td>U</td>\n",
       "      <td>GT3</td>\n",
367
       "      <td>T</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
368
       "      <td>4</td>\n",
369
       "      <td>3</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
370
       "      <td>teacher</td>\n",
371 372 373 374 375 376 377
       "      <td>other</td>\n",
       "      <td>...</td>\n",
       "      <td>yes</td>\n",
       "      <td>no</td>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
378 379 380 381 382
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>6</td>\n",
       "      <td>10</td>\n",
383 384
       "    </tr>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
385 386
       "      <th>150</th>\n",
       "      <td>GP</td>\n",
387
       "      <td>M</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
388
       "      <td>18</td>\n",
389 390 391 392 393 394
       "      <td>U</td>\n",
       "      <td>LE3</td>\n",
       "      <td>T</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>other</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
395
       "      <td>other</td>\n",
396 397
       "      <td>...</td>\n",
       "      <td>yes</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
398
       "      <td>yes</td>\n",
399 400 401
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
       "      <td>2</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>85</th>\n",
       "      <td>GP</td>\n",
       "      <td>F</td>\n",
       "      <td>15</td>\n",
       "      <td>U</td>\n",
       "      <td>GT3</td>\n",
       "      <td>T</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>services</td>\n",
       "      <td>services</td>\n",
       "      <td>...</td>\n",
       "      <td>yes</td>\n",
       "      <td>yes</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
428
       "      <td>5</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
429 430
       "      <td>6</td>\n",
       "      <td>8</td>\n",
431 432
       "    </tr>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
433
       "      <th>261</th>\n",
434 435 436 437
       "      <td>GP</td>\n",
       "      <td>M</td>\n",
       "      <td>18</td>\n",
       "      <td>U</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
438
       "      <td>GT3</td>\n",
439
       "      <td>T</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
440 441 442
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>teacher</td>\n",
443 444 445 446 447
       "      <td>other</td>\n",
       "      <td>...</td>\n",
       "      <td>yes</td>\n",
       "      <td>no</td>\n",
       "      <td>4</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
448
       "      <td>3</td>\n",
449
       "      <td>2</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
450 451 452
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
453 454 455 456 457 458 459 460 461 462
       "      <td>2</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10 rows × 31 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    school sex  age address famsize Pstatus  Medu  Fedu      Mjob      Fjob  \\\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
463 464 465 466
       "55      GP   F   16       U     GT3       A     2     1     other     other   \n",
       "155     GP   M   15       R     GT3       T     2     3   at_home  services   \n",
       "151     GP   M   16       U     LE3       T     2     1   at_home     other   \n",
       "82      GP   F   15       U     LE3       T     3     2  services     other   \n",
467
       "24      GP   F   15       R     GT3       T     2     4  services    health   \n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
468 469 470 471 472
       "18      GP   M   17       U     GT3       T     3     2  services  services   \n",
       "75      GP   M   15       U     GT3       T     4     3   teacher     other   \n",
       "150     GP   M   18       U     LE3       T     1     1     other     other   \n",
       "85      GP   F   15       U     GT3       T     4     4  services  services   \n",
       "261     GP   M   18       U     GT3       T     4     3   teacher     other   \n",
473 474
       "\n",
       "    ... internet romantic  famrel  freetime  goout Dalc Walc health absences  \\\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
475 476 477 478
       "55  ...      yes      yes       5         3      4    1    1      2        8   \n",
       "155 ...       no       no       4         4      4    1    1      1        2   \n",
       "151 ...       no      yes       4         4      4    3    5      5        6   \n",
       "82  ...      yes       no       4         4      4    1    1      5       10   \n",
479
       "24  ...      yes       no       4         3      2    1    1      5        2   \n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
480 481 482 483 484
       "18  ...      yes       no       5         5      5    2    4      5       16   \n",
       "75  ...      yes       no       4         3      3    2    3      5        6   \n",
       "150 ...      yes      yes       2         3      5    2    5      4        0   \n",
       "85  ...      yes      yes       4         4      4    2    3      5        6   \n",
       "261 ...      yes       no       4         3      2    1    1      3        2   \n",
485 486
       "\n",
       "     G3  \n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
487 488 489 490
       "55   10  \n",
       "155   8  \n",
       "151  14  \n",
       "82    6  \n",
491
       "24    8  \n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
492 493 494 495 496
       "18    5  \n",
       "75   10  \n",
       "150   0  \n",
       "85    8  \n",
       "261   8  \n",
497 498 499 500
       "\n",
       "[10 rows x 31 columns]"
      ]
     },
Sylvain Marchienne's avatar
Sylvain Marchienne committed
501
     "execution_count": 5,
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.sample(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Travailler avec les variables catégorielles"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
Sylvain Marchienne's avatar
Sylvain Marchienne committed
521
    "Il y a ce qu'on appelle des variables catégorielles, dont les valeurs ne sont pas numériques et continues. Il y a par exemple la variable `school` qui est soit GP soit MS (nom des deux écoles). Mais aussi `Mjob` (mother's job) qui prend des valeurs dans {teacher, health, services, ...}. Ces valeurs ne sont pas calculables telles quelles. Seuls les arbres de décisions peuvent accepter ces valeurs (pourquoi ?).\n",
522 523
    "\n",
    "Il faut donc faire une transformation. Deux stratégies sont possibles:\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
524 525 526 527
    "\n",
    "* **Integer encoding** : on donne une valeur entière à chaque modalité (teacher devient 0, health devient 1, services 2, etc). Le problème avec ça, c'est qu'on introduit un biais. 0 < 2 et donc _teacher_ deviendrait \"inférieur\" à _services_ ? Cette stratégie n'est donc pas toujours pertinente, sauf pour les modalités où il y a une relation d'ordre.\n",
    "\n",
    "* **One-hot encoding**: on va binariser les variables, par exemple `school` va prendre les valeurs 0 et 1. Si school=GP alors on met 0 à place, si school=MS on met 1. Mais qu'est-ce qu'il se passe lorsque notre a variable a plus de deux modalités possibles (`Mjob`) ? Il faut créer des nouvelles variables ! `Mjob_teacher` prend la valeur 0 si ce n'est pas teacher et 1 si oui, `Mjob_health` pareil, etc. En fait, si on a $n$ modalités, on peut créer $n$ variables. En pratique $n-1$, car la dernière modalité correspondrait au cas où les $n-1$ variables crées sont à 0. Un article qui reprend cette méthode: https://machinelearningmastery.com/why-one-hot-encode-data-in-machine-learning/\n",
528 529 530 531 532 533
    "\n",
    "Notre dataset contient beaucoup de variables catégorielles, on vous épargne le preprocessing à faire dessus, mais c'est toujours bon d'avoir ça en tête. En pratique, la majorité des datasets ont besoin de passer par là !"
   ]
  },
  {
   "cell_type": "code",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
534
   "execution_count": 7,
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>age</th>\n",
       "      <th>traveltime</th>\n",
       "      <th>studytime</th>\n",
       "      <th>failures</th>\n",
       "      <th>famrel</th>\n",
       "      <th>freetime</th>\n",
       "      <th>goout</th>\n",
       "      <th>Dalc</th>\n",
       "      <th>Walc</th>\n",
       "      <th>health_Mjob</th>\n",
       "      <th>...</th>\n",
       "      <th>no_nursery</th>\n",
       "      <th>yes_nursery</th>\n",
       "      <th>no_higher</th>\n",
       "      <th>yes_higher</th>\n",
       "      <th>no_internet</th>\n",
       "      <th>yes_internet</th>\n",
       "      <th>no_romantic</th>\n",
       "      <th>yes_romantic</th>\n",
       "      <th>no</th>\n",
       "      <th>yes</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
583
       "      <th>108</th>\n",
584 585 586
       "      <td>15</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
587
       "      <td>0</td>\n",
588 589
       "      <td>1</td>\n",
       "      <td>3</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
590 591 592
       "      <td>5</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
593
       "      <td>1</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
594
       "      <td>...</td>\n",
595
       "      <td>0</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
596
       "      <td>1</td>\n",
597 598 599 600 601 602 603 604 605 606
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
607 608 609
       "      <th>349</th>\n",
       "      <td>18</td>\n",
       "      <td>2</td>\n",
610 611
       "      <td>1</td>\n",
       "      <td>1</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
612 613 614
       "      <td>2</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
615 616 617 618 619 620 621 622
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
623
       "      <td>0</td>\n",
624 625 626
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
627
       "      <td>1</td>\n",
628 629 630
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
631 632
       "      <th>182</th>\n",
       "      <td>17</td>\n",
633
       "      <td>1</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
634
       "      <td>2</td>\n",
635 636
       "      <td>0</td>\n",
       "      <td>5</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
637 638 639
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
640 641 642 643 644 645 646 647 648 649 650
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
651 652
       "      <td>1</td>\n",
       "      <td>0</td>\n",
653 654
       "    </tr>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
655
       "      <th>384</th>\n",
656
       "      <td>18</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
657
       "      <td>2</td>\n",
658
       "      <td>1</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
659 660 661
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
662 663 664 665 666 667 668 669 670 671 672 673
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
674
       "      <td>0</td>\n",
675 676 677 678
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
679 680
       "      <th>226</th>\n",
       "      <td>17</td>\n",
681 682
       "      <td>1</td>\n",
       "      <td>2</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
683 684
       "      <td>0</td>\n",
       "      <td>5</td>\n",
685 686 687
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
688 689 690
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>...</td>\n",
691
       "      <td>0</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
692
       "      <td>1</td>\n",
693 694
       "      <td>1</td>\n",
       "      <td>0</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
695
       "      <td>0</td>\n",
696 697 698 699 700 701 702
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
703
       "      <th>102</th>\n",
704 705
       "      <td>15</td>\n",
       "      <td>1</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
706
       "      <td>1</td>\n",
707 708 709 710 711 712
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
713
       "      <td>5</td>\n",
714 715 716 717 718
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
719
       "      <td>0</td>\n",
720 721 722 723 724 725 726
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
727
       "      <th>93</th>\n",
728
       "      <td>16</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
729 730
       "      <td>2</td>\n",
       "      <td>2</td>\n",
731
       "      <td>0</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
732
       "      <td>5</td>\n",
733 734 735 736
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
737 738
       "      <td>1</td>\n",
       "      <td>...</td>\n",
739
       "      <td>0</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
740
       "      <td>1</td>\n",
741 742 743 744 745 746 747 748 749 750
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
751 752 753
       "      <th>48</th>\n",
       "      <td>15</td>\n",
       "      <td>1</td>\n",
754 755
       "      <td>2</td>\n",
       "      <td>0</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
756 757
       "      <td>4</td>\n",
       "      <td>3</td>\n",
758 759 760
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
761
       "      <td>5</td>\n",
762 763 764 765
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
766
       "      <td>1</td>\n",
767 768 769 770 771 772 773 774
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
775 776 777 778 779
       "      <th>193</th>\n",
       "      <td>16</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
780
       "      <td>4</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
781
       "      <td>3</td>\n",
782 783
       "      <td>2</td>\n",
       "      <td>3</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
784
       "      <td>4</td>\n",
785 786 787 788 789 790 791 792 793 794
       "      <td>5</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
795 796
       "      <td>1</td>\n",
       "      <td>0</td>\n",
797 798
       "    </tr>\n",
       "    <tr>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
799 800
       "      <th>377</th>\n",
       "      <td>18</td>\n",
801
       "      <td>1</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
802 803 804 805 806
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
807 808 809 810 811
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
812
       "      <td>1</td>\n",
813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10 rows × 65 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     age  traveltime  studytime  failures  famrel  freetime  goout  Dalc  \\\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
829 830 831 832 833 834 835 836 837 838
       "108   15           4          4         0       1         3      5     3   \n",
       "349   18           2          1         1       2         5      5     5   \n",
       "182   17           1          2         0       5         4      2     2   \n",
       "384   18           2          1         1       5         4      3     4   \n",
       "226   17           1          2         0       5         3      4     1   \n",
       "102   15           1          1         0       5         3      3     1   \n",
       "93    16           2          2         0       5         3      3     1   \n",
       "48    15           1          2         0       4         3      3     2   \n",
       "193   16           1          1         0       4         3      2     3   \n",
       "377   18           1          2         0       5         4      3     3   \n",
839 840
       "\n",
       "     Walc  health_Mjob ...   no_nursery  yes_nursery  no_higher  yes_higher  \\\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
841 842 843 844 845 846 847 848 849 850
       "108     5            1 ...            0            1          0           1   \n",
       "349     5            5 ...            1            0          1           0   \n",
       "182     3            5 ...            0            1          0           1   \n",
       "384     3            3 ...            1            0          0           1   \n",
       "226     3            3 ...            0            1          1           0   \n",
       "102     1            5 ...            0            1          1           0   \n",
       "93      1            1 ...            0            1          0           1   \n",
       "48      2            5 ...            1            0          0           1   \n",
       "193     4            5 ...            0            1          0           1   \n",
       "377     4            2 ...            0            1          0           1   \n",
851 852
       "\n",
       "     no_internet  yes_internet  no_romantic  yes_romantic  no  yes  \n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
853 854 855 856 857 858 859 860 861 862
       "108            0             1            0             1   0    1  \n",
       "349            0             1            0             1   1    0  \n",
       "182            0             1            1             0   1    0  \n",
       "384            0             1            1             0   1    0  \n",
       "226            0             1            0             1   1    0  \n",
       "102            0             1            0             1   1    0  \n",
       "93             0             1            0             1   1    0  \n",
       "48             0             1            1             0   1    0  \n",
       "193            0             1            0             1   1    0  \n",
       "377            0             1            0             1   1    0  \n",
863 864 865 866
       "\n",
       "[10 rows x 65 columns]"
      ]
     },
Sylvain Marchienne's avatar
Sylvain Marchienne committed
867
     "execution_count": 7,
868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "final_data = data.copy()\n",
    "for feature in [\n",
    "    \"school\", \"sex\", \"address\", \"famsize\", \"Pstatus\",\n",
    "    \"Medu\", \"Fedu\", \"Mjob\", \"Fjob\", \"reason\", \"guardian\",\n",
    "    \"schoolsup\", \"famsup\", \"paid\", \"activities\", \"nursery\",\n",
    "    \"higher\", \"internet\", \"romantic\"\n",
    "]:\n",
    "    final_data = final_data.join(pd.get_dummies(final_data[feature]), lsuffix=f\"_{feature}\").drop(feature, axis = 1)\n",
    "\n",
    "final_data.sample(10)"
   ]
  },
  {
   "cell_type": "code",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
887
   "execution_count": 8,
888 889 890 891 892 893 894 895
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(395, 65)"
      ]
     },
Sylvain Marchienne's avatar
Sylvain Marchienne committed
896
     "execution_count": 8,
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "final_data.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "On obtient des données uniquement numériques, mais avec beaucoup plus de colonnes."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# A vous de jouer\n",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
917
    "Visualiser, faire potentiellement une sélection de variables (il y en aurait-il trop par rapport au nombre de samples/lignes?), diviser les données en train/test puis appliquer les modèles vus en cours (et d'autres) pour construire le meilleur régresseur capable de prédire la variable G3. Utiliser Scikit-learn. Bonne chance !\n",
918 919 920 921 922 923
    "\n",
    "PS: de manière générale, cherchez à visualiser et comprendre les données pour comprendre pourquoi ça marche bien ou pas, ne soyez pas étonné si les résultats ne sont pas bons au début"
   ]
  },
  {
   "cell_type": "code",
Sylvain Marchienne's avatar
Sylvain Marchienne committed
924
   "execution_count": 9,
925 926 927 928 929 930 931 932
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((395, 64), (395,))"
      ]
     },
Sylvain Marchienne's avatar
Sylvain Marchienne committed
933
     "execution_count": 9,
934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Données numpy à utiliser\n",
    "X = final_data.drop(\"G3\", axis=1).values\n",
    "y = final_data[\"G3\"].values\n",
    "X.shape, y.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "metadata": {},
   "outputs": [],
   "source": [
    "# commencer ici"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  },
  "toc": {
   "colors": {
    "hover_highlight": "#DAA520",
    "navigate_num": "#000000",
    "navigate_text": "#333333",
    "running_highlight": "#FF0000",
    "selected_highlight": "#FFD700",
    "sidebar_border": "#EEEEEE",
    "wrapper_background": "#FFFFFF"
   },
   "moveMenuLeft": true,
   "nav_menu": {
    "height": "102px",
    "width": "252px"
   },
   "navigate_menu": true,
   "number_sections": true,
   "sideBar": true,
   "threshold": 4,
   "toc_cell": false,
   "toc_section_display": "block",
   "toc_window_display": false,
   "widenNotebook": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}