TP_classification.ipynb 66.4 KB
Newer Older
1 2 3 4 5 6 7 8
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# TP Apprentissage supervisé: Classification / Discrimination\n",
    "\n",
9
    "Dans ce tp, on fait de la Classification / Discrimination, c'est-à-dire que l'on connaît les \"vrais\" labels de nos classes. \n",
10 11 12
    "\n",
    "On va utiliser les données Breast cancer dataset (classification).\n",
    "\n",
13
    "Une description de ces données est disponible à l'adresse https://scikit-learn.org/stable/datasets/index.html#breast-cancer-wisconsin-diagnostic-dataset. Jetez un coup d'oeil pour comprendre la problématique.\n",
14
    "\n",
15
    "Importez les libraries de ce matin: `numpy` et `scikit datasets`."
16 17 18 19
   ]
  },
  {
   "cell_type": "code",
TheophilePACE's avatar
TheophilePACE committed
20
   "execution_count": 1,
21 22
   "metadata": {},
   "outputs": [],
TheophilePACE's avatar
TheophilePACE committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
   "source": [
    "import numpy as np\n",
    "from sklearn import datasets\n",
    "from matplotlib import pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "breast_cancer = datasets.load_breast_cancer()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = breast_cancer.data\n",
    "y = breast_cancer.target\n",
    "feature_names = breast_cancer.feature_names"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(569, 30) (569,)\n",
      "[0 0 0 0 0]\n",
      "['mean radius' 'mean texture' 'mean perimeter' 'mean area'\n",
      " 'mean smoothness' 'mean compactness' 'mean concavity'\n",
      " 'mean concave points' 'mean symmetry' 'mean fractal dimension'\n",
      " 'radius error' 'texture error' 'perimeter error' 'area error'\n",
      " 'smoothness error' 'compactness error' 'concavity error'\n",
      " 'concave points error' 'symmetry error' 'fractal dimension error'\n",
      " 'worst radius' 'worst texture' 'worst perimeter' 'worst area'\n",
      " 'worst smoothness' 'worst compactness' 'worst concavity'\n",
      " 'worst concave points' 'worst symmetry' 'worst fractal dimension']\n"
     ]
    }
   ],
   "source": [
    "print(X.shape, y.shape)\n",
    "print(y[:5])\n",
    "print(feature_names)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([2.057e+01, 1.777e+01, 1.329e+02, 1.326e+03, 8.474e-02])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X[1][:5]"
   ]
97 98 99 100 101
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
102
    "Chargez les données depuis `datasets.load_boston`. Que renvoie cette fonction ? Chargez vos données dans des variables appelées X et y pour avoir, respectivement, les données et les labels."
103 104 105 106 107 108 109
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Formatage du jeu de données\n",
110
    "Pour entraîner nos algorithmes, on va splitter notre jeu de données en 3 sous-jeux de données: \n",
111 112 113 114 115 116
    "- train\n",
    "- validation\n",
    "- test\n",
    "\n",
    "Pourquoi est-ce nécessaire?\n",
    "\n",
TheophilePACE's avatar
TheophilePACE committed
117 118 119
    "Pour cela, utilisez la fonction scikit-learn `sklearn.model_selection.train_test_split`. Importez cette méthode, appliquer là à nos données.\n",
    "\n",
    "On utilise 2 fois train_test_split, afin de séparer 2 fois l'ensemble: une fois entre train_validation d'une part, unee fois entre train et validation."
120 121 122 123
   ]
  },
  {
   "cell_type": "code",
TheophilePACE's avatar
TheophilePACE committed
124
   "execution_count": 6,
125 126
   "metadata": {},
   "outputs": [],
TheophilePACE's avatar
TheophilePACE committed
127 128 129 130 131 132 133 134 135 136 137 138 139
   "source": [
    "from sklearn.model_selection import train_test_split"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_tv,X_test, y_tv,y_test = train_test_split(X,y,test_size=.2, random_state=42)\n",
    "X_train,X_validation,y_train,y_validation = train_test_split(X_tv,y_tv,test_size=.25,random_state=42)"
   ]
140 141 142 143 144 145
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# K-NNs\n",
146
    "On va lancer les k-nns sur ce dataset. Essayez `K = 1`, puis `K = n` (n est le nombre de samples). Observez dans $R^2$. Commentez."
147 148 149 150
   ]
  },
  {
   "cell_type": "code",
TheophilePACE's avatar
TheophilePACE committed
151
   "execution_count": 8,
152 153
   "metadata": {},
   "outputs": [],
TheophilePACE's avatar
TheophilePACE committed
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
   "source": [
    "from sklearn.neighbors import KNeighborsClassifier \n",
    "from sklearn.metrics import confusion_matrix, accuracy_score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 0.9298245614035088\n",
      "[[40  4]\n",
      " [ 4 66]]\n",
      "4 0.9210526315789473\n",
      "[[40  4]\n",
      " [ 5 65]]\n",
      "7 0.9385964912280702\n",
      "[[40  4]\n",
      " [ 3 67]]\n",
      "10 0.9385964912280702\n",
      "[[40  4]\n",
      " [ 3 67]]\n",
      "13 0.9298245614035088\n",
      "[[39  5]\n",
      " [ 3 67]]\n",
      "16 0.9210526315789473\n",
      "[[39  5]\n",
      " [ 4 66]]\n",
      "19 0.9298245614035088\n",
      "[[39  5]\n",
      " [ 3 67]]\n"
     ]
    }
   ],
   "source": [
    "# hyperparamter\n",
    "K_max = 20\n",
    "for K in range(1,K_max,3):\n",
    "    # declare classifier with hyperparameters\n",
    "    knn = KNeighborsClassifier(n_neighbors=K)\n",
    "    # train (aka fit) the classifier on the train dataset\n",
    "    knn.fit(X_train,y_train)\n",
    "    # predict the validation dataset\n",
    "    y_validation_hat = knn.predict(X_validation)\n",
    "    # check the result\n",
    "    print(K,accuracy_score(y_pred=y_validation_hat,y_true=y_validation))\n",
    "    print(confusion_matrix(y_pred=y_validation_hat,y_true=y_validation))\n",
    "    # Now, adjust hyperparamaeters"
   ]
207 208 209 210 211
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
TheophilePACE's avatar
TheophilePACE committed
212 213 214
    "Comment choisir K? Essayez différents K, regardez les résultats.\n",
    "\n",
    "Notre objectif est de minimiseer le taux d'erreur. On va tracer 1 - accuracy en fonction de K, et choisir le K le plus faibble:"
215 216 217 218
   ]
  },
  {
   "cell_type": "code",
TheophilePACE's avatar
TheophilePACE committed
219
   "execution_count": 10,
220
   "metadata": {},
TheophilePACE's avatar
TheophilePACE committed
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x10cea2748>]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAA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s3lw4zgDuvp/EvF+XkugC6b0wNTWuZMzB9smk32044lJinhd0r7m7HwP+nVM4zmFI+suBuuCMfBGJEzCLsxzTAGZWYmalvcvAdcCrJGLtvaPY7cAT2YnwhIaKcTHw0WAEwaXAgd6uiWzr16/5uySONSRinh+M1KglMTHgS1mIz4B/A15z92+kbBqXx3qoeMfzcTazKkvM9ouZTQDeS+JcxFLg1qBa/2Pce+xvBZ714GzpWBki5tdTGgJG4hxE6nHO7HMx1menR+NB4gx2E4n+ui9kO54hYpxJYjTDamBtb5wk+gx/AawP/i3Pcpw/IPEzvZNEK+KOoWIk8dNyYXDcXwHqx1HMjwYxrQn+Y5yRUv8LQcyNwA1ZivlyEj/D1wCrgseN4/VYnyDecXucgbeRmPxxTZAk7wvKZ5L4AtoA/BCIBeXFwfqGYPvMcRTzs8FxfhX4fxwf4ZPx50JX5IqI5JEwdO+IiEialPRFRPKIkr6ISB5R0hcRySNK+iIieURJX0Qkjyjpi4jkESV9EZE88v8B1Sg3Y6MqafQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# hyperparamter\n",
    "K_max = len(X_train)\n",
    "accuracies = []\n",
    "for K in range(1,K_max,1):\n",
    "    # declare classifier with hyperparameters\n",
    "    knn = KNeighborsClassifier(n_neighbors=K)\n",
    "    # train (aka fit) the classifier on the train dataset\n",
    "    knn.fit(X_train,y_train)\n",
    "    # predict the validation dataset\n",
    "    y_validation_hat = knn.predict(X_validation)\n",
    "    # check the result\n",
    "    accuracies.append(accuracy_score(y_pred=y_validation_hat,y_true=y_validation))\n",
    "# si on trace juste le tableau, on sera décalé de 1\n",
    "plt.plot(range(1,K_max),accuracies)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x10ce03748>]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJztnX20JHdZ579Pv1T17Zc7k7m3O4bMkASZFQaNYRkCgpgQWQ3iJkBYDCKgx7M5euAcPYqarMqezSGHxc0Kuyt6ZBUBwcWQFcyRCMvGRFnByMS8E5IMgZDJhHTfO5m53fdOV789+0fVr7pu3aquX3VXvz+fc+ZMd3VV9a/6Vv2e3/NOzAxBEARBSE17AIIgCMJsIAJBEARBACACQRAEQXAQgSAIgiAAEIEgCIIgOIhAEARBEACIQBAEQRAcRCAIgiAIAEQgCIIgCA6ZaQ8gDuvr63zhhRdOexiCIAhzxT333LPBzOWo/eZKIFx44YU4duzYtIchCIIwVxDRkzr7iclIEARBACACQRAEQXAQgSAIgiAAEIEgCIIgOIhAEARBEACIQBAEQRAcRCAIgiAIAOYsD2GSfPGh7+FlF5yDcskc+Vx/9S8n8J2N7VjHrK5k8QuvvgjpFGntf7xaR7Vu4VXfvz7MEAUhcf7piU189fhGrGOy6RR+9hXPx1px9OdOiI8IhACa7S5++dP34L0/8QN492tfOPK5fu2W+wEApDe3Q7W5vvSiA7j44H6tYz705cdx73efw1dv+PFhhikIifP+L3wDDz29Ffu+318w8I5XXjC+gQmhiEAIwGr3wAxsNdsjn6u6ZQEAfu8tF+OtRw9pHfPAidO46g/+Ec86x+rwva0mqnULvR4jpalVCMI4+d4ZC9e+/BD+8zUXa+3fbHfxot/9IuoJPHfCcIgPIQCr0wUA7Fjdkc9VazQBIJbpSe1bq+sLhFrdQqfHeG6nFW+AgjAGuj3GqW0r1n1vZlJIUTLPnTAcIhACaLZ7AIDtVmfkcykNo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Mv+/5aOGvn4jKjmYAIloB8DrYPpQ7AbzF2W0hrx0AmPkGZj7IzBfCfs7/jpnfjiW4fiIqEFFJvQbwEwAeQoL3/cIkphHRT8FeKaQBfIyZb5rykMYKEf0vAJfDrnT4LID/CODzAG4B8HwA3wXw75jZ73iee4joRwF8BcCD6NuR/wNsP8JCXz8RXQzbcZiGvaC7hZlvJKIXwF4xHwBwL4CfY2ZreiMdP47J6L3M/NPLcP3ONX7OeZsB8BfMfBMRrSGh+35hBIIgCIIwGotiMhIEQRBGRASCIAiCAEAEgiAIguAgAkEQBEEAIAJBEARBcBCBIAiCIAAQgSAIgiA4iEAQBEEQAAD/HwQJ451KUKvDAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(range(1,50),accuracies[:49])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0.9385964912280702, 3)"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# On cherche le k ayant la precision maximale: argument du maximum, + 1 car les index sont décalés de 1\n",
    "np.max(accuracies),np.argmax(accuracies)+1"
   ]
310 311 312 313 314
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
315 316
    "# Algorithme Bayésien naif (NBC)\n",
    "\n",
317
    "On va maintenant utiliser l'agorithme bayésien naif (*naive baeysian classifier* pour les gens hype). Pour rappel, le modèle se base sur l'indépendance des _features_ et l'hypothèse gaussienne. Les amoureux de SY01 se souviendront de la formule de bayes: \n",
318 319 320
    "$$\n",
    "P(X | Y) = \\frac{P(Y|X) \\times P(X)}{P(Y)}\n",
    "$$\n",
321
    "Bref, commencez par importer le NBC depuis scikit-learn. https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.GaussianNB.html"
322 323
   ]
  },
TheophilePACE's avatar
TheophilePACE committed
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 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 428 429 430 431 432
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[0;31mInit signature:\u001b[0m \u001b[0mGaussianNB\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpriors\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvar_smoothing\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1e-09\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
       "\u001b[0;31mDocstring:\u001b[0m     \n",
       "Gaussian Naive Bayes (GaussianNB)\n",
       "\n",
       "Can perform online updates to model parameters via `partial_fit` method.\n",
       "For details on algorithm used to update feature means and variance online,\n",
       "see Stanford CS tech report STAN-CS-79-773 by Chan, Golub, and LeVeque:\n",
       "\n",
       "    http://i.stanford.edu/pub/cstr/reports/cs/tr/79/773/CS-TR-79-773.pdf\n",
       "\n",
       "Read more in the :ref:`User Guide <gaussian_naive_bayes>`.\n",
       "\n",
       "Parameters\n",
       "----------\n",
       "priors : array-like, shape (n_classes,)\n",
       "    Prior probabilities of the classes. If specified the priors are not\n",
       "    adjusted according to the data.\n",
       "\n",
       "var_smoothing : float, optional (default=1e-9)\n",
       "    Portion of the largest variance of all features that is added to\n",
       "    variances for calculation stability.\n",
       "\n",
       "Attributes\n",
       "----------\n",
       "class_prior_ : array, shape (n_classes,)\n",
       "    probability of each class.\n",
       "\n",
       "class_count_ : array, shape (n_classes,)\n",
       "    number of training samples observed in each class.\n",
       "\n",
       "theta_ : array, shape (n_classes, n_features)\n",
       "    mean of each feature per class\n",
       "\n",
       "sigma_ : array, shape (n_classes, n_features)\n",
       "    variance of each feature per class\n",
       "\n",
       "epsilon_ : float\n",
       "    absolute additive value to variances\n",
       "\n",
       "Examples\n",
       "--------\n",
       ">>> import numpy as np\n",
       ">>> X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])\n",
       ">>> Y = np.array([1, 1, 1, 2, 2, 2])\n",
       ">>> from sklearn.naive_bayes import GaussianNB\n",
       ">>> clf = GaussianNB()\n",
       ">>> clf.fit(X, Y)\n",
       "GaussianNB(priors=None, var_smoothing=1e-09)\n",
       ">>> print(clf.predict([[-0.8, -1]]))\n",
       "[1]\n",
       ">>> clf_pf = GaussianNB()\n",
       ">>> clf_pf.partial_fit(X, Y, np.unique(Y))\n",
       "GaussianNB(priors=None, var_smoothing=1e-09)\n",
       ">>> print(clf_pf.predict([[-0.8, -1]]))\n",
       "[1]\n",
       "\u001b[0;31mFile:\u001b[0m           ~/miniconda3/lib/python3.6/site-packages/sklearn/naive_bayes.py\n",
       "\u001b[0;31mType:\u001b[0m           ABCMeta\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from sklearn.naive_bayes import GaussianNB\n",
    "# no hyperparamter\n",
    "nbc = GaussianNB?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "nbc = GaussianNB"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[40  4]\n",
      " [ 5 65]]\n",
      "0.9210526315789473\n"
     ]
    }
   ],
   "source": [
    "clf = GaussianNB()\n",
    "clf.fit(X=X_train,y=y_train)\n",
    "y_validation_hat = clf.predict(X_validation)\n",
    "print(confusion_matrix(y_pred=y_validation_hat, y_true=y_validation))\n",
    "print(accuracy_score(y_pred=y_validation_hat, y_true=y_validation))"
   ]
  },
433 434 435 436
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
TheophilePACE's avatar
TheophilePACE committed
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485
    "__On compare toujours les modèles sur l'ensemble de test!__\n",
    "Pour chaque modèle\n",
    "- On entraine sur X_train\n",
    "- On prédit X_validation, on ajuste ses paramètres\n",
    "- on réentraine sur X_train\n",
    "- On prédit X_validation, et ainsi de suite tant que le résultat n'est pas satisfaisant\n",
    "- __Finalement, une seule fois__, on lance sur X_test. \n",
    "- On compare avec les autres modèle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "K-NN With k= 6\n",
      "0.956140350877193\n",
      "[[42  1]\n",
      " [ 4 67]]\n",
      "NBC\n",
      "0.9649122807017544\n",
      "[[40  3]\n",
      " [ 1 70]]\n"
     ]
    }
   ],
   "source": [
    "# COMPARAISON DES MODELES\n",
    "# K-NN\n",
    "# declare classifier with hyperparameters\n",
    "knn = KNeighborsClassifier(n_neighbors=6)\n",
    "# train (aka fit) the classifier on the train dataset\n",
    "knn.fit(X_train,y_train)\n",
    "# predict the validation dataset\n",
    "y_test_hat_knn = knn.predict(X_test)\n",
    "# check the result\n",
    "print(\"K-NN With k= 6\")\n",
    "print(accuracy_score(y_pred=y_test_hat_knn,y_true=y_test))\n",
    "print(confusion_matrix(y_pred=y_test_hat_knn,y_true=y_test))\n",
    "\n",
    "# NBC\n",
    "y_test_hat_nbc = clf.predict(X_test)\n",
    "print(\"NBC\")\n",
    "print(accuracy_score(y_pred=y_test_hat_nbc,y_true=y_test))\n",
    "print(confusion_matrix(y_pred=y_test_hat_nbc,y_true=y_test))"
486 487 488 489 490 491
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
492
    "**Optionel** Quels sont vos résultats? Essayez d'afficher vos clusters en 2D dans $R^2$. Vous pouvez appliquer une PCA et garder 2 composantes. De là, c'est possible de plot dans $R^2$."
493 494 495 496 497 498
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
499 500 501 502
    "# Régression logistique\n",
    "\n",
    "On va utiliser la régression logistique (aka *logistic regression*). Rappel de ce modèle, pour deux classes: \n",
    "\n",
503 504 505
    "$$Pr(C_0 | features) + Pr(C_1 | features) = 1$$\n",
    "$$Pr(C_1 | features) = \\frac{1}{1+\\exp^{w_O +w_1\\times features}}$$\n",
    "\n",
506 507 508 509
    "Avec $C_0$ et $C_1$ les deux classes à discriminer. On veut donc déterminer les poids $w = (w_0,w_1)$.\n",
    "\n",
    "Et, de manière assez inattendue... Scikit propose un implémentation de la régression logistique. La doc est consultable ici: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html\n",
    "\n",
TheophilePACE's avatar
TheophilePACE committed
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550
    "Appliquez la régression logistique toujours sur les données `breast_cancer`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.linear_model import LogisticRegression"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.9649122807017544\n",
      "[[42  2]\n",
      " [ 2 68]]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/theophilepace/miniconda3/lib/python3.6/site-packages/sklearn/linear_model/logistic.py:433: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n",
      "  FutureWarning)\n"
     ]
    }
   ],
   "source": [
    "logreg = LogisticRegression()\n",
    "logreg.fit(X_train,y_train)\n",
    "y_hat = logreg.predict(X_validation)\n",
    "print(accuracy_score(y_pred=y_hat,y_true=y_validation))\n",
    "print(confusion_matrix(y_pred=y_hat,y_true=y_validation))"
551 552 553 554 555 556
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
557
    "Quels sont vos résultats (calculer l'accuracy) ? Sont-ils meilleurs que pour le NBC?"
558 559
   ]
  },
TheophilePACE's avatar
TheophilePACE committed
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.956140350877193\n",
      "[[39  4]\n",
      " [ 1 70]]\n"
     ]
    }
   ],
   "source": [
    "pred= logreg.predict(X_test)\n",
    "print(accuracy_score(y_pred=pred,y_true=y_test))\n",
    "print(confusion_matrix(y_pred=pred,y_true=y_test))"
   ]
  },
581 582 583 584
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
585
    "Le principal avantage de la régression logistique est son interprétabilité, grâce aux poids. Quelles sont les features qui vous ont permis de discriminer entre les classes? Regardez et comparer pour cela les poids du vecteur $w$."
586 587
   ]
  },
TheophilePACE's avatar
TheophilePACE committed
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 2.16929585e+00,  1.03505165e-01, -1.69351567e-01,\n",
       "        -4.09229286e-04, -1.26894192e-01, -4.17556456e-01,\n",
       "        -6.57815732e-01, -3.19770431e-01, -1.87089660e-01,\n",
       "        -2.83143858e-02, -1.98836785e-02,  1.43346281e+00,\n",
       "        -2.24578570e-01, -6.55814280e-02, -1.53238693e-02,\n",
       "        -2.51797663e-02, -7.41128784e-02, -3.60638850e-02,\n",
       "        -4.08750126e-02,  1.59879611e-03,  1.23695888e+00,\n",
       "        -3.83174555e-01, -1.67220956e-02, -2.81166697e-02,\n",
       "        -2.40073214e-01, -1.25834089e+00, -1.67423372e+00,\n",
       "        -5.79028509e-01, -6.93277983e-01, -1.24763925e-01]])"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "logreg.coef_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
624 625 626 627
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
628
    "**optionel** Essayez de tracer vos classes dans $R^2$, en utilisant les 2 features les plus discriminantes."
629 630
   ]
  },
TheophilePACE's avatar
TheophilePACE committed
631 632 633 634 635 636 637
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
638 639 640 641
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
642 643 644 645 646 647
    "# Support Vector Machine (SVM)\n",
    "\n",
    "Machine à vecteur de Support (Système à Vaste Marge pour les littéraires), les SVMs sont des algorithmes plus complexes. \n",
    "\n",
    "Ils perdent l'interprétabilité de la *logistic regression*, mais permettent d'obtenir des frontières de décision non linéaires grâce au kernel trick. Très puissants, ils ont été les algorithmes phares des années 90 et début 2000.\n",
    "\n",
648
    "Le modèle est assez complexe, basé sur l'estimation de la marge. Voici pour rappel un schéma volé sur Wikipédia, qui présente le cas facilement séparable:\n",
649 650 651 652 653 654 655 656 657 658 659
    "\n",
    "<img src=\"https://upload.wikimedia.org/wikipedia/commons/7/72/SVM_margin.png\" width=\"400\" height=\"400\" />\n",
    "\n",
    "La puissance des SVM est basée sur la notion de kernel explorée en détail ce matin. On utilisera le noyau gaussien, appelé `rbf` dans scikit."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Utilisation"
660 661 662 663 664 665 666
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Étonnement, nous utiliserons l'implémentation scikit-learn. La doc est ici : https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html\n",
667
    "Importez cette méthode. Consulter la doc string ou la documentation intégrée. Quels sont les paramètres?"
668 669 670 671 672 673
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
674
    "Lancez un SVM sur nos données, avec un noyeau linéaire `kernel='linear'`. "
675 676
   ]
  },
677 678
  {
   "cell_type": "code",
TheophilePACE's avatar
TheophilePACE committed
679
   "execution_count": 20,
680
   "metadata": {},
TheophilePACE's avatar
TheophilePACE committed
681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.956140350877193\n",
      "[[42  2]\n",
      " [ 3 67]]\n"
     ]
    }
   ],
   "source": [
    "from sklearn.svm import SVC\n",
    "svm = SVC(kernel='linear')\n",
    "svm.fit(X_train,y_train)\n",
    "y_hat = svm.predict(X_validation)\n",
    "print(accuracy_score(y_pred=y_hat,y_true=y_validation))\n",
    "print(confusion_matrix(y_pred=y_hat,y_true=y_validation))"
   ]
700
  },
701 702 703 704 705 706 707 708 709 710 711 712 713 714
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Cela revient en fait à appliquer un classifieur linéaire sur le jeu de données. Quels sont vos résultats? Sont-ils très différents de ceux obtenus avec la regression logisitique ?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "On va maintenant utiliser un noyeau non linéaire, le `rbf`. Réutilisez votre code précédent, en changeant simplement le kernel."
   ]
  },
TheophilePACE's avatar
TheophilePACE committed
715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.9298245614035088\n",
      "[[39  5]\n",
      " [ 3 67]]\n"
     ]
    }
   ],
   "source": [
    "svm = SVC(kernel='rbf', gamma='scale')\n",
    "svm.fit(X_train,y_train)\n",
    "y_hat = svm.predict(X_validation)\n",
    "print(accuracy_score(y_pred=y_hat,y_true=y_validation))\n",
    "print(confusion_matrix(y_pred=y_hat,y_true=y_validation))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.956140350877193\n",
      "[[39  4]\n",
      " [ 1 70]]\n"
     ]
    }
   ],
   "source": [
    "y_pred = svm.predict(X_test)\n",
    "print(accuracy_score(y_pred=pred,y_true=y_test))\n",
    "print(confusion_matrix(y_pred=pred,y_true=y_test))"
   ]
  },
759 760 761 762
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
763
    "## Performances / complexité"
764 765 766 767 768 769
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
770 771 772 773 774 775 776
    "C'est fini? Pas encore? Toujours pas? La méthode est bien plus complexe que la régression logistique. \n",
    "Plus complexe --> plus de calculs --> plus lent.\n",
    "Quels sont vos résultats (calculer l'accuracy ici)? Sont-ils meilleurs que précédemment?"
   ]
  },
  {
   "cell_type": "code",
TheophilePACE's avatar
TheophilePACE committed
777
   "execution_count": 23,
778
   "metadata": {},
TheophilePACE's avatar
TheophilePACE committed
779 780 781 782 783 784 785 786 787 788 789 790 791 792
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "204 µs ± 6.73 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)\n",
      "829 µs ± 56.4 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)\n"
     ]
    }
   ],
   "source": [
    "%timeit clf.predict(X_train)\n",
    "%timeit svm.predict(X_test)"
   ]
793 794 795 796 797 798
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "En fait, il n'y a pas que le kernel qui paramètrise votre SVM. Le paramètre de régularisation est aussi à fixer. Pour l'instant quel est votre paramètre C? Regardez dans la doc (il y a une valeur par défaut).\n",
799 800 801 802
    "\n",
    "Essayez `C=20`. Commentez vos résultats."
   ]
  },
803 804 805 806 807 808 809
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
810 811 812 813
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
814
    "Cherchez \"à la main\" un `C` optimal. Nous verrons plus tard comment faire cela automatiquement."
815 816 817 818 819 820
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
821
    "**optionel** Vous souvenez-vous de la commande magic permettant de connaitre le temps de calcul d'une cellule ? `%timeit`\n",
822
    "Comparez le temps pris par la régression logistique et le SVM."
823 824 825 826 827 828
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
829
    "# Arbres de décision\n",
830 831
    "Les arbres de décision sont une méthode extrêmement puissante, surtout quand ils sont utilisés avec des méthodes de boosting (que nous verrons peut-être aussi aujourd'hui). De plus, les arbres sont très interprétables. C'est à dire qu'on peut comprendre facilement comment une prédiction à été faite, en suivant dans l'arbre le chemin à travers les noeuds.\n",
    "\n",
832
    "![](https://upload.wikimedia.org/wikipedia/commons/2/25/Cart_tree_kyphosis.png)\n",
833 834 835 836
    "\n",
    "On va utiliser cette méthode pour faire de la classification. Cherchez l'implémentation scikit de cette méthode. En anglais, on parle de *decision tree classifier*.  https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html#sklearn.tree.DecisionTreeClassifier\n",
    "\n",
    "Consulter la doc string."
837 838
   ]
  },
TheophilePACE's avatar
TheophilePACE committed
839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "ename": "NotImplementedError",
     "evalue": "INSTALLEZ GRAPHVIZ",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNotImplementedError\u001b[0m                       Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-43-e8b47aed4505>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0msklearn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtree\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mDecisionTreeClassifier\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mNotImplementedError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"INSTALLEZ GRAPHVIZ\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      4\u001b[0m \u001b[0;31m# ne vous occupez pas de cette fonction, c'est juste de la visu\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      5\u001b[0m \u001b[0;31m#!pip install graphviz\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mNotImplementedError\u001b[0m: INSTALLEZ GRAPHVIZ"
     ]
    }
   ],
   "source": [
    "from sklearn.tree import DecisionTreeClassifier\n",
    "\n",
    "raise NotImplementedError(\"INSTALLEZ GRAPHVIZ\")\n",
    "# ne vous occupez pas de cette fonction, c'est juste de la visu\n",
    "\n",
    "from graphviz import Source\n",
    "from sklearn.tree import export_graphviz\n",
    "from IPython.display import SVG\n",
    "\n",
    "\n",
    "def visualize_tree(clf):\n",
    "    dotefile_string = export_graphviz(clf, out_file=None,feature_names=feature_names, class_names=breast_cancer.target_names)\n",
    "    graph = Source(dotefile_string)\n",
    "    return SVG(graph.pipe('svg'))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Lancez un arbre avec `DecisionTreeClassifier`. Essayez sur votre ensemble de validation."
   ]
  },
880 881 882 883 884
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
TheophilePACE's avatar
TheophilePACE committed
885 886 887 888 889 890 891
   "source": [
    "# Déclarer le classifieur, avec si nécessaire les hyperparamètres\n",
    "# Entrainer les hyperparamètres\n",
    "# Prédire sur l'ensemble de validation\n",
    "# Regarder les résultats\n",
    "raise NotImplementedError(\"implementez un arbre!\")"
   ]
892
  },
893 894 895 896
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
TheophilePACE's avatar
TheophilePACE committed
897
    "Bravo! Vous venez de découvrir l'*overfitting*!! C'est-à-dire que votre arbre a tout appris par coeur, et a donc trop de branches. On va donc faire de l'élagage, c'est à dire limiter le nombre de noeuds / bbranches/ fueilles. Ce point est géré par l'hyperparamètre `max_depth`. Essayer avec `max_depth=1`, puis quelques autres valeurs. Vous pouvez comparer les accuracies obtenues sur l'ensembble de validation."
898 899
   ]
  },
900 901 902 903 904
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
TheophilePACE's avatar
TheophilePACE committed
905 906 907 908
   "source": [
    "# Déclarer le classifieur, avec un hyperparamètre max_depth\n",
    "raise NotImplementedError(\"Essayez avec un arbre borné\")"
   ]
909 910 911 912 913
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
TheophilePACE's avatar
TheophilePACE committed
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956
    "Évidemment, cela n'est pas satisfaisant! On va donc effectuer une recherche sur le paramètre `max_depth`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def search_best_depth(maximum_depth:int):\n",
    "    accuracies = []\n",
    "    for depth in range(1,maximum_depth):\n",
    "        # entrainer l'arbre pour cette valeur de max_depth\n",
    "        raise NotImplementedError(\"Entrainez l'arbre!\")\n",
    "        # predire sur l'ensemble de validation\n",
    "        raise NotImplementedError(\"Prédire!\")\n",
    "        accuracy_score(y_hat,y_validation)\n",
    "        # stocker l'accuracy dans accuracies\n",
    "        accuracies.append(accuracy)\n",
    "    return accuracies\n",
    "\n",
    "# On entraine notre arbre!\n",
    "maximum_depth = \"Choisissez un max depth\"\n",
    "accuracies_tree = search_best_depth(maximum_depth)\n",
    "plt.plot(range(1,len(accuracies_tree)+1), accuracies_tree)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Quel `max_depth` choisissez-vous ? On va entrainer notre classifieur avec cette hyperparamètre, puis essayer sur test."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Réentrainner avec le max_depth choisi\n",
    "\n",
    "# Prédire test, comparer avec les autres"
957 958
   ]
  },
959 960 961 962
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
963
    "**optionel** tracer votre arbre en 2D. Vous pouvez utiliser le tuto suivant: https://scikit-learn.org/stable/auto_examples/tree/plot_iris.html#sphx-glr-auto-examples-tree-plot-iris-py"
964 965
   ]
  },
TheophilePACE's avatar
TheophilePACE committed
966 967 968 969 970 971 972
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
973 974 975 976 977
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Random Forest\n",
978
    "Les forêts aléatoires sont des classifieurs extrêmement puissants, qui s'appuient sur le bootstrap, et le bagging. Ce sont des techniques statistiques assez avancées qui consistent à:\n",
979 980
    "- *bootstrap*: faire des tirages avec remise dans le jeu de données\n",
    "- *bagging*: entrainer le même modèle sur différents bootstrap, et faire un vote pour classifier.\n",
981
    "\n",
TheophilePACE's avatar
TheophilePACE committed
982 983 984 985
    "Schématiquement:\n",
    "\n",
    "![](https://www.researchgate.net/profile/Evaldas_Vaiciukynas/publication/301411533/figure/fig1/AS:401835392290816@1472816431620/A-general-random-forest-architecture.png)\n",
    "\n",
986 987
    "Problème: l'interprétation devient plus difficile avec tous les arbres.\n",
    "\n",
988 989 990 991 992 993 994
    "La documentation est disponible à https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
TheophilePACE's avatar
TheophilePACE committed
995 996
    "Après avoir regardé la documentation, lancez une random forest avec `n_estimators = 15`:\n",
    "_Note: relancer plusieurs fois, le bootstrap repose sur de l'aléatoire_"
997 998 999
   ]
  },
  {
1000
   "cell_type": "code",
TheophilePACE's avatar
TheophilePACE committed
1001
   "execution_count": 76,
1002
   "metadata": {},
TheophilePACE's avatar
TheophilePACE committed
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9649122807017544"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.ensemble import RandomForestClassifier\n",
    "clf = RandomForestClassifier(n_estimators=500)\n",
    "clf.fit(X=X_train,y=y_train)\n",
    "y_hat = clf.predict(X_validation)\n",
    "accuracy_score(y_pred=y_hat,y_true=y_validation)"
   ]
1022 1023 1024 1025 1026
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
1027
    "Comparez vos résultats avec ceux obtenu avec un arbre (`DecisionTreeClassifier`). Regardez bien sur l'ensemble de test puis sur l'ensemble de validation. Que remarquez-vous? À quoi cela est dû?"
1028 1029
   ]
  },
TheophilePACE's avatar
TheophilePACE committed
1030 1031 1032 1033 1034 1035 1036
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
1037 1038 1039 1040
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
TheophilePACE's avatar
TheophilePACE committed
1041
    "Rééssayez avec  `n_estimators = 100`,  `n_estimators = 500`. "
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
1052
   "cell_type": "markdown",
1053
   "metadata": {},
1054 1055 1056
   "source": [
    "Comparez vos résultats. "
   ]
TheophilePACE's avatar
TheophilePACE committed
1057 1058 1059 1060 1061 1062 1063 1064
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Si vous vous ennuyez\n",
    "Faites les visualisations en __optionel__"
   ]
1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082
  }
 ],
 "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",
TheophilePACE's avatar
TheophilePACE committed
1083
   "version": "3.6.6"
1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107
  },
  "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": "192px",
    "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
1108 1109 1110 1111 1112
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}