diff --git a/03_classification.ipynb b/03_classification.ipynb index 846af67..ba65a7e 100644 --- a/03_classification.ipynb +++ b/03_classification.ipynb @@ -39,7 +39,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Let's import a few common modules, ensure MatplotLib plots figures inline and prepare a function to save the figures." + "This project requires Python 3.8 or above:" ] }, { @@ -48,20 +48,16 @@ "metadata": {}, "outputs": [], "source": [ - "# Python ≥3.8 is required\n", "import sys\n", - "assert sys.version_info >= (3, 8)\n", "\n", - "# Scikit-Learn ≥1.0.1 is required\n", - "import sklearn\n", - "assert sklearn.__version__ >= \"1.0.1\"" + "assert sys.version_info >= (3, 8)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "# MNIST" + "It also requires Scikit-Learn ≥ 1.0.1:" ] }, { @@ -70,9 +66,16 @@ "metadata": {}, "outputs": [], "source": [ - "from sklearn.datasets import fetch_openml\n", + "import sklearn\n", "\n", - "mnist = fetch_openml('mnist_784', version=1, as_frame=False)" + "assert sklearn.__version__ >= \"1.0.1\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Just like in the previous chapter, let's define the default font sizes to make the figures prettier:" ] }, { @@ -81,8 +84,18 @@ "metadata": {}, "outputs": [], "source": [ - "# Not in the book\n", - "print(mnist.DESCR)" + "import matplotlib as mpl\n", + "\n", + "mpl.rc('font', size=12)\n", + "mpl.rc('axes', labelsize=14, titlesize=14)\n", + "mpl.rc('legend', fontsize=14)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "And let's create the `images/classification` folder (if it doesn't already exist), and define the `save_fig()` function which is used through this notebook to save the figures in high-res for the book:" ] }, { @@ -91,78 +104,8 @@ "metadata": {}, "outputs": [], "source": [ - "# Not in the book\n", - "mnist.keys()" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [], - "source": [ - "X, y = mnist.data, mnist.target\n", - "X" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [], - "source": [ - "X.shape" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [], - "source": [ - "mnist.target" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [], - "source": [ - "y.shape" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [], - "source": [ - "28 * 28" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "The following cell is not shown in the book. It's just here to define the default font size for the figures, and to define the `save_fig()` function which is used to save the figures in high-resolution for the book, just like we did in the previous chapter:" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [], - "source": [ - "# To plot pretty figures\n", "from pathlib import Path\n", - "import matplotlib as mpl\n", "\n", - "mpl.rc('font', size=12)\n", - "mpl.rc('axes', labelsize=14, titlesize=14)\n", - "mpl.rc('legend', fontsize=14)\n", - "\n", - "# To save the figures in high-res for the book\n", "IMAGES_PATH = Path() / \"images\" / \"classification\"\n", "IMAGES_PATH.mkdir(parents=True, exist_ok=True)\n", "\n", @@ -173,11 +116,95 @@ " plt.savefig(path, format=fig_extension, dpi=resolution)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# MNIST" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "from sklearn.datasets import fetch_openml\n", + "\n", + "mnist = fetch_openml('mnist_784', version=1, as_frame=False)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "# not in the book\n", + "print(mnist.DESCR)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "# not in the book\n", + "mnist.keys()" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "X, y = mnist.data, mnist.target\n", + "X" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "X.shape" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [], + "source": [ + "y" + ] + }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], + "source": [ + "y.shape" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [], + "source": [ + "28 * 28" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "\n", @@ -188,13 +215,13 @@ "\n", "some_digit = X[0]\n", "plot_digit(some_digit)\n", - "save_fig(\"some_digit_plot\")\n", + "save_fig(\"some_digit_plot\") # not in the book\n", "plt.show()" ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 14, "metadata": {}, "outputs": [], "source": [ @@ -203,7 +230,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ @@ -219,7 +246,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ @@ -235,7 +262,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 17, "metadata": {}, "outputs": [], "source": [ @@ -245,7 +272,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 18, "metadata": {}, "outputs": [], "source": [ @@ -257,7 +284,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 19, "metadata": {}, "outputs": [], "source": [ @@ -280,7 +307,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 20, "metadata": {}, "outputs": [], "source": [ @@ -291,7 +318,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 21, "metadata": {}, "outputs": [], "source": [ @@ -310,12 +337,12 @@ " clone_clf.fit(X_train_folds, y_train_folds)\n", " y_pred = clone_clf.predict(X_test_fold)\n", " n_correct = sum(y_pred == y_test_fold)\n", - " print(n_correct / len(y_pred)) # prints 0.95035, 0.96035 and 0.9604" + " print(n_correct / len(y_pred))" ] }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -323,12 +350,12 @@ "\n", "dummy_clf = DummyClassifier()\n", "dummy_clf.fit(X_train, y_train_5)\n", - "print(any(dummy_clf.predict(X_train))) # prints False: no 5s detected" + "print(any(dummy_clf.predict(X_train)))" ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ @@ -344,7 +371,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 24, "metadata": {}, "outputs": [], "source": [ @@ -355,7 +382,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 25, "metadata": {}, "outputs": [], "source": [ @@ -366,7 +393,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 26, "metadata": {}, "outputs": [], "source": [ @@ -383,35 +410,13 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 27, "metadata": {}, "outputs": [], "source": [ "from sklearn.metrics import precision_score, recall_score\n", "\n", - "precision_score(y_train_5, y_train_pred)" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": {}, - "outputs": [], - "source": [ - "# Not in the book\n", - "cm = confusion_matrix(y_train_5, y_train_pred)\n", - "\n", - "# Precision = TP / (FP + TP)\n", - "cm[1, 1] / (cm[0, 1] + cm[1, 1])" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": {}, - "outputs": [], - "source": [ - "recall_score(y_train_5, y_train_pred)" + "precision_score(y_train_5, y_train_pred) # == 3530 / (687 + 3530)" ] }, { @@ -420,14 +425,38 @@ "metadata": {}, "outputs": [], "source": [ - "# Not in the book\n", + "# not in the book\n", + "\n", + "cm = confusion_matrix(y_train_5, y_train_pred)\n", + "\n", + "# Precision = TP / (FP + TP)\n", + "cm[1, 1] / (cm[0, 1] + cm[1, 1])" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [], + "source": [ + "recall_score(y_train_5, y_train_pred) # == 3530 / (1891 + 3530)" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [], + "source": [ + "# not in the book\n", + "\n", "# Recall = TP / (FN + TP)\n", "cm[1, 1] / (cm[1, 0] + cm[1, 1])" ] }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 31, "metadata": {}, "outputs": [], "source": [ @@ -438,7 +467,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 32, "metadata": {}, "outputs": [], "source": [ @@ -454,7 +483,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 33, "metadata": {}, "outputs": [], "source": [ @@ -464,7 +493,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 34, "metadata": {}, "outputs": [], "source": [ @@ -474,7 +503,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 35, "metadata": {}, "outputs": [], "source": [ @@ -483,18 +512,18 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 36, "metadata": {}, "outputs": [], "source": [ - "# Not in the book\n", + "# not in the book\n", "# Using threshold 0, we get exactly the same predictions as with predict()\n", "(y_train_pred == (y_scores > 0)).all()" ] }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 37, "metadata": {}, "outputs": [], "source": [ @@ -505,7 +534,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 38, "metadata": {}, "outputs": [], "source": [ @@ -515,7 +544,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 39, "metadata": {}, "outputs": [], "source": [ @@ -526,7 +555,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 40, "metadata": {}, "outputs": [], "source": [ @@ -541,7 +570,7 @@ "plt.plot(thresholds[idx], precisions[idx], \"bo\")\n", "plt.plot(thresholds[idx], recalls[idx], \"go\")\n", "plt.axis([-50000, 50000, 0, 1])\n", - "plt.grid(True)\n", + "plt.grid()\n", "plt.xlabel(\"Threshold\")\n", "plt.legend(loc=\"center right\")\n", "save_fig(\"precision_recall_vs_threshold_plot\")\n", @@ -551,7 +580,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 41, "metadata": {}, "outputs": [], "source": [ @@ -575,7 +604,7 @@ "plt.xlabel(\"Recall\")\n", "plt.ylabel(\"Precision\")\n", "plt.axis([0, 1, 0, 1])\n", - "plt.grid(True)\n", + "plt.grid()\n", "plt.legend(loc=\"lower left\")\n", "save_fig(\"precision_vs_recall_plot\")\n", "\n", @@ -584,7 +613,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 42, "metadata": {}, "outputs": [], "source": [ @@ -595,7 +624,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 43, "metadata": {}, "outputs": [], "source": [ @@ -604,7 +633,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 44, "metadata": {}, "outputs": [], "source": [ @@ -613,7 +642,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 45, "metadata": {}, "outputs": [], "source": [ @@ -630,7 +659,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 46, "metadata": {}, "outputs": [], "source": [ @@ -641,14 +670,14 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 47, "metadata": {}, "outputs": [], "source": [ "idx_for_threshold_at_90 = (thresholds <= threshold_for_90_precision).argmax()\n", "tpr_90, fpr_90 = tpr[idx_for_threshold_at_90], fpr[idx_for_threshold_at_90]\n", "\n", - "plt.figure(figsize=(6, 5)) # Not in the book\n", + "plt.figure(figsize=(6, 5)) # not in the book\n", "plt.plot(fpr, tpr, linewidth=2, label=\"ROC curve\")\n", "plt.plot([0, 1], [0, 1], 'k:', label=\"Random classifier's ROC curve\")\n", "plt.plot([fpr_90], [tpr_90], \"ko\", label=\"Threshold for 90% precision\")\n", @@ -662,7 +691,7 @@ "plt.text(0.12, 0.71, \"Higher\\nthreshold\", fontsize=14, color=\"#333333\")\n", "plt.xlabel('False Positive Rate (Fall-Out)')\n", "plt.ylabel('True Positive Rate (Recall)')\n", - "plt.grid(True)\n", + "plt.grid()\n", "plt.axis([0, 1, 0, 1])\n", "plt.legend(loc=\"lower right\")\n", "save_fig(\"roc_curve_plot\")\n", @@ -672,7 +701,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 48, "metadata": {}, "outputs": [], "source": [ @@ -690,7 +719,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 49, "metadata": {}, "outputs": [], "source": [ @@ -701,7 +730,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 50, "metadata": {}, "outputs": [], "source": [ @@ -711,7 +740,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 51, "metadata": {}, "outputs": [], "source": [ @@ -727,7 +756,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 52, "metadata": {}, "outputs": [], "source": [ @@ -738,7 +767,7 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 53, "metadata": {}, "outputs": [], "source": [ @@ -749,7 +778,7 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 54, "metadata": {}, "outputs": [], "source": [ @@ -762,7 +791,7 @@ "# not in the book\n", "plt.xlabel('False Positive Rate (Fall-Out)')\n", "plt.ylabel('True Positive Rate (Recall)')\n", - "plt.grid(True)\n", + "plt.grid()\n", "plt.axis([0, 1, 0, 1])\n", "plt.legend(loc=\"lower right\")\n", "save_fig(\"roc_curve_comparison_plot\")\n", @@ -772,7 +801,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 55, "metadata": {}, "outputs": [], "source": [ @@ -788,7 +817,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 56, "metadata": {}, "outputs": [], "source": [ @@ -798,7 +827,7 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 57, "metadata": {}, "outputs": [], "source": [ @@ -821,7 +850,7 @@ }, { "cell_type": "code", - "execution_count": 56, + "execution_count": 58, "metadata": {}, "outputs": [], "source": [ @@ -833,7 +862,7 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 59, "metadata": {}, "outputs": [], "source": [ @@ -842,7 +871,7 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": 60, "metadata": {}, "outputs": [], "source": [ @@ -852,7 +881,7 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": 61, "metadata": {}, "outputs": [], "source": [ @@ -862,7 +891,7 @@ }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 62, "metadata": {}, "outputs": [], "source": [ @@ -871,7 +900,7 @@ }, { "cell_type": "code", - "execution_count": 61, + "execution_count": 63, "metadata": {}, "outputs": [], "source": [ @@ -887,11 +916,11 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 64, "metadata": {}, "outputs": [], "source": [ - "# Not in the book\n", + "# not in the book\n", "svm_clf.decision_function_shape = \"ovo\"\n", "some_digit_scores_ovo = svm_clf.decision_function([some_digit])\n", "some_digit_scores_ovo.round(2)" @@ -899,20 +928,28 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 65, "metadata": {}, "outputs": [], "source": [ "from sklearn.multiclass import OneVsRestClassifier\n", "\n", "ovr_clf = OneVsRestClassifier(SVC(random_state=42))\n", - "ovr_clf.fit(X_train[:2000], y_train[:2000])\n", + "ovr_clf.fit(X_train[:2000], y_train[:2000])" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": {}, + "outputs": [], + "source": [ "ovr_clf.predict([some_digit])" ] }, { "cell_type": "code", - "execution_count": 64, + "execution_count": 67, "metadata": {}, "outputs": [], "source": [ @@ -921,7 +958,7 @@ }, { "cell_type": "code", - "execution_count": 65, + "execution_count": 68, "metadata": {}, "outputs": [], "source": [ @@ -932,7 +969,7 @@ }, { "cell_type": "code", - "execution_count": 66, + "execution_count": 69, "metadata": {}, "outputs": [], "source": [ @@ -948,7 +985,7 @@ }, { "cell_type": "code", - "execution_count": 67, + "execution_count": 70, "metadata": {}, "outputs": [], "source": [ @@ -957,7 +994,7 @@ }, { "cell_type": "code", - "execution_count": 68, + "execution_count": 71, "metadata": {}, "outputs": [], "source": [ @@ -984,7 +1021,7 @@ }, { "cell_type": "code", - "execution_count": 69, + "execution_count": 72, "metadata": {}, "outputs": [], "source": [ @@ -997,7 +1034,7 @@ }, { "cell_type": "code", - "execution_count": 70, + "execution_count": 73, "metadata": {}, "outputs": [], "source": [ @@ -1008,7 +1045,7 @@ }, { "cell_type": "code", - "execution_count": 71, + "execution_count": 74, "metadata": {}, "outputs": [], "source": [ @@ -1028,11 +1065,11 @@ }, { "cell_type": "code", - "execution_count": 72, + "execution_count": 75, "metadata": {}, "outputs": [], "source": [ - "# Not in the book\n", + "# not in the book\n", "fig, axs = plt.subplots(nrows=2, ncols=2, figsize=(9, 8))\n", "ConfusionMatrixDisplay.from_predictions(y_train, y_train_pred, ax=axs[0, 0])\n", "axs[0, 0].set_title(\"Confusion matrix\")\n", @@ -1047,13 +1084,13 @@ " sample_weight=sample_weight,\n", " normalize=\"pred\", values_format=\".0%\")\n", "axs[1, 1].set_title(\"Errors normalized by column\")\n", - "save_fig(\"confusion_matrix_plot\")\n", + "save_fig(\"confusion_matrix_plot\") # not in the book\n", "plt.show()" ] }, { "cell_type": "code", - "execution_count": 73, + "execution_count": 76, "metadata": {}, "outputs": [], "source": [ @@ -1066,7 +1103,7 @@ }, { "cell_type": "code", - "execution_count": 74, + "execution_count": 77, "metadata": {}, "outputs": [], "source": [ @@ -1114,8 +1151,10 @@ }, { "cell_type": "code", - "execution_count": 75, - "metadata": {}, + "execution_count": 78, + "metadata": { + "tags": [] + }, "outputs": [], "source": [ "import numpy as np\n", @@ -1131,7 +1170,7 @@ }, { "cell_type": "code", - "execution_count": 76, + "execution_count": 79, "metadata": {}, "outputs": [], "source": [ @@ -1147,25 +1186,17 @@ }, { "cell_type": "code", - "execution_count": 77, - "metadata": {}, - "outputs": [], - "source": [ - "y_train_knn_pred = cross_val_predict(knn_clf, X_train, y_multilabel, cv=3)" - ] - }, - { - "cell_type": "code", - "execution_count": 78, + "execution_count": 80, "metadata": {}, "outputs": [], "source": [ + "y_train_knn_pred = cross_val_predict(knn_clf, X_train, y_multilabel, cv=3)\n", "f1_score(y_multilabel, y_train_knn_pred, average=\"macro\")" ] }, { "cell_type": "code", - "execution_count": 79, + "execution_count": 81, "metadata": {}, "outputs": [], "source": [ @@ -1175,14 +1206,22 @@ }, { "cell_type": "code", - "execution_count": 80, + "execution_count": 82, "metadata": {}, "outputs": [], "source": [ "from sklearn.multioutput import ClassifierChain\n", "\n", "chain_clf = ClassifierChain(SVC(), cv=3, random_state=42)\n", - "chain_clf.fit(X_train[:2000], y_multilabel[:2000])\n", + "chain_clf.fit(X_train[:2000], y_multilabel[:2000])" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": {}, + "outputs": [], + "source": [ "chain_clf.predict([some_digit])" ] }, @@ -1195,11 +1234,11 @@ }, { "cell_type": "code", - "execution_count": 81, + "execution_count": 84, "metadata": {}, "outputs": [], "source": [ - "np.random.seed(42) # as always, this is to make this example reproducible\n", + "np.random.seed(42) # to make this code example reproducible\n", "noise = np.random.randint(0, 100, (len(X_train), 784))\n", "X_train_mod = X_train + noise\n", "noise = np.random.randint(0, 100, (len(X_test), 784))\n", @@ -1210,7 +1249,7 @@ }, { "cell_type": "code", - "execution_count": 82, + "execution_count": 85, "metadata": {}, "outputs": [], "source": [ @@ -1224,14 +1263,14 @@ }, { "cell_type": "code", - "execution_count": 83, + "execution_count": 86, "metadata": {}, "outputs": [], "source": [ "knn_clf.fit(X_train_mod, y_train_mod)\n", "clean_digit = knn_clf.predict([X_test_mod[some_index]])\n", "plot_digit(clean_digit)\n", - "save_fig(\"cleaned_digit_example_plot\")\n", + "save_fig(\"cleaned_digit_example_plot\") # not in the book\n", "plt.show()" ] }, @@ -1244,7 +1283,7 @@ }, { "cell_type": "code", - "execution_count": 84, + "execution_count": 87, "metadata": {}, "outputs": [], "source": [ @@ -1295,7 +1334,7 @@ }, { "cell_type": "code", - "execution_count": 85, + "execution_count": 88, "metadata": {}, "outputs": [], "source": [ @@ -1321,7 +1360,7 @@ }, { "cell_type": "code", - "execution_count": 86, + "execution_count": 89, "metadata": {}, "outputs": [], "source": [ @@ -1336,7 +1375,7 @@ }, { "cell_type": "code", - "execution_count": 87, + "execution_count": 90, "metadata": {}, "outputs": [], "source": [ @@ -1345,7 +1384,7 @@ }, { "cell_type": "code", - "execution_count": 88, + "execution_count": 91, "metadata": {}, "outputs": [], "source": [ @@ -1361,7 +1400,7 @@ }, { "cell_type": "code", - "execution_count": 89, + "execution_count": 92, "metadata": {}, "outputs": [], "source": [ @@ -1400,7 +1439,7 @@ }, { "cell_type": "code", - "execution_count": 90, + "execution_count": 93, "metadata": {}, "outputs": [], "source": [ @@ -1409,7 +1448,7 @@ }, { "cell_type": "code", - "execution_count": 91, + "execution_count": 94, "metadata": {}, "outputs": [], "source": [ @@ -1428,7 +1467,7 @@ }, { "cell_type": "code", - "execution_count": 92, + "execution_count": 95, "metadata": {}, "outputs": [], "source": [ @@ -1461,7 +1500,7 @@ }, { "cell_type": "code", - "execution_count": 93, + "execution_count": 96, "metadata": {}, "outputs": [], "source": [ @@ -1486,7 +1525,7 @@ }, { "cell_type": "code", - "execution_count": 94, + "execution_count": 97, "metadata": {}, "outputs": [], "source": [ @@ -1504,7 +1543,7 @@ }, { "cell_type": "code", - "execution_count": 95, + "execution_count": 98, "metadata": {}, "outputs": [], "source": [ @@ -1513,7 +1552,7 @@ }, { "cell_type": "code", - "execution_count": 96, + "execution_count": 99, "metadata": {}, "outputs": [], "source": [ @@ -1529,7 +1568,7 @@ }, { "cell_type": "code", - "execution_count": 97, + "execution_count": 100, "metadata": {}, "outputs": [], "source": [ @@ -1545,7 +1584,7 @@ }, { "cell_type": "code", - "execution_count": 98, + "execution_count": 101, "metadata": { "tags": [] }, @@ -1585,7 +1624,7 @@ }, { "cell_type": "code", - "execution_count": 99, + "execution_count": 102, "metadata": {}, "outputs": [], "source": [ @@ -1609,7 +1648,7 @@ }, { "cell_type": "code", - "execution_count": 100, + "execution_count": 103, "metadata": {}, "outputs": [], "source": [ @@ -1632,7 +1671,7 @@ }, { "cell_type": "code", - "execution_count": 101, + "execution_count": 104, "metadata": {}, "outputs": [], "source": [ @@ -1672,7 +1711,7 @@ }, { "cell_type": "code", - "execution_count": 102, + "execution_count": 105, "metadata": {}, "outputs": [], "source": [ @@ -1689,7 +1728,7 @@ }, { "cell_type": "code", - "execution_count": 103, + "execution_count": 106, "metadata": {}, "outputs": [], "source": [ @@ -1698,7 +1737,7 @@ }, { "cell_type": "code", - "execution_count": 104, + "execution_count": 107, "metadata": {}, "outputs": [], "source": [ @@ -1728,7 +1767,7 @@ }, { "cell_type": "code", - "execution_count": 105, + "execution_count": 108, "metadata": {}, "outputs": [], "source": [ @@ -1753,7 +1792,7 @@ }, { "cell_type": "code", - "execution_count": 106, + "execution_count": 109, "metadata": {}, "outputs": [], "source": [ @@ -1769,7 +1808,7 @@ }, { "cell_type": "code", - "execution_count": 107, + "execution_count": 110, "metadata": {}, "outputs": [], "source": [ @@ -1778,7 +1817,7 @@ }, { "cell_type": "code", - "execution_count": 108, + "execution_count": 111, "metadata": {}, "outputs": [], "source": [ @@ -1787,7 +1826,7 @@ }, { "cell_type": "code", - "execution_count": 109, + "execution_count": 112, "metadata": {}, "outputs": [], "source": [ @@ -1810,7 +1849,7 @@ }, { "cell_type": "code", - "execution_count": 110, + "execution_count": 113, "metadata": {}, "outputs": [], "source": [ @@ -1832,7 +1871,7 @@ }, { "cell_type": "code", - "execution_count": 111, + "execution_count": 114, "metadata": {}, "outputs": [], "source": [ @@ -1841,7 +1880,7 @@ }, { "cell_type": "code", - "execution_count": 112, + "execution_count": 115, "metadata": {}, "outputs": [], "source": [ @@ -1861,7 +1900,7 @@ }, { "cell_type": "code", - "execution_count": 113, + "execution_count": 116, "metadata": {}, "outputs": [], "source": [ @@ -1885,7 +1924,7 @@ }, { "cell_type": "code", - "execution_count": 114, + "execution_count": 117, "metadata": {}, "outputs": [], "source": [ @@ -1902,7 +1941,7 @@ }, { "cell_type": "code", - "execution_count": 115, + "execution_count": 118, "metadata": {}, "outputs": [], "source": [ @@ -1918,7 +1957,7 @@ }, { "cell_type": "code", - "execution_count": 116, + "execution_count": 119, "metadata": {}, "outputs": [], "source": [ @@ -1935,7 +1974,7 @@ }, { "cell_type": "code", - "execution_count": 117, + "execution_count": 120, "metadata": {}, "outputs": [], "source": [ @@ -1952,7 +1991,7 @@ }, { "cell_type": "code", - "execution_count": 118, + "execution_count": 121, "metadata": {}, "outputs": [], "source": [ @@ -1976,7 +2015,7 @@ }, { "cell_type": "code", - "execution_count": 119, + "execution_count": 122, "metadata": {}, "outputs": [], "source": [ @@ -2003,7 +2042,7 @@ }, { "cell_type": "code", - "execution_count": 120, + "execution_count": 123, "metadata": {}, "outputs": [], "source": [ @@ -2037,7 +2076,7 @@ }, { "cell_type": "code", - "execution_count": 121, + "execution_count": 124, "metadata": {}, "outputs": [], "source": [ @@ -2047,7 +2086,7 @@ }, { "cell_type": "code", - "execution_count": 122, + "execution_count": 125, "metadata": {}, "outputs": [], "source": [ @@ -2081,7 +2120,7 @@ }, { "cell_type": "code", - "execution_count": 123, + "execution_count": 126, "metadata": {}, "outputs": [], "source": [ @@ -2108,7 +2147,7 @@ }, { "cell_type": "code", - "execution_count": 124, + "execution_count": 127, "metadata": {}, "outputs": [], "source": [ @@ -2124,7 +2163,7 @@ }, { "cell_type": "code", - "execution_count": 125, + "execution_count": 128, "metadata": {}, "outputs": [], "source": [ @@ -2134,7 +2173,7 @@ }, { "cell_type": "code", - "execution_count": 126, + "execution_count": 129, "metadata": {}, "outputs": [], "source": [ @@ -2143,7 +2182,7 @@ }, { "cell_type": "code", - "execution_count": 127, + "execution_count": 130, "metadata": {}, "outputs": [], "source": [ @@ -2159,7 +2198,7 @@ }, { "cell_type": "code", - "execution_count": 128, + "execution_count": 131, "metadata": {}, "outputs": [], "source": [ @@ -2173,7 +2212,7 @@ }, { "cell_type": "code", - "execution_count": 129, + "execution_count": 132, "metadata": {}, "outputs": [], "source": [ @@ -2190,7 +2229,7 @@ }, { "cell_type": "code", - "execution_count": 130, + "execution_count": 133, "metadata": {}, "outputs": [], "source": [ @@ -2199,7 +2238,7 @@ }, { "cell_type": "code", - "execution_count": 131, + "execution_count": 134, "metadata": {}, "outputs": [], "source": [ @@ -2215,7 +2254,7 @@ }, { "cell_type": "code", - "execution_count": 132, + "execution_count": 135, "metadata": {}, "outputs": [], "source": [ @@ -2234,7 +2273,7 @@ }, { "cell_type": "code", - "execution_count": 133, + "execution_count": 136, "metadata": {}, "outputs": [], "source": [ @@ -2250,7 +2289,7 @@ }, { "cell_type": "code", - "execution_count": 134, + "execution_count": 137, "metadata": {}, "outputs": [], "source": [ @@ -2259,7 +2298,7 @@ }, { "cell_type": "code", - "execution_count": 135, + "execution_count": 138, "metadata": {}, "outputs": [], "source": [ @@ -2282,7 +2321,7 @@ }, { "cell_type": "code", - "execution_count": 136, + "execution_count": 139, "metadata": {}, "outputs": [], "source": [ @@ -2299,7 +2338,7 @@ }, { "cell_type": "code", - "execution_count": 137, + "execution_count": 140, "metadata": {}, "outputs": [], "source": [ @@ -2315,7 +2354,7 @@ }, { "cell_type": "code", - "execution_count": 138, + "execution_count": 141, "metadata": {}, "outputs": [], "source": [ @@ -2338,7 +2377,7 @@ }, { "cell_type": "code", - "execution_count": 139, + "execution_count": 142, "metadata": {}, "outputs": [], "source": [ @@ -2362,7 +2401,7 @@ }, { "cell_type": "code", - "execution_count": 140, + "execution_count": 143, "metadata": {}, "outputs": [], "source": [ @@ -2381,7 +2420,7 @@ }, { "cell_type": "code", - "execution_count": 141, + "execution_count": 144, "metadata": {}, "outputs": [], "source": [ @@ -2397,7 +2436,7 @@ }, { "cell_type": "code", - "execution_count": 142, + "execution_count": 145, "metadata": {}, "outputs": [], "source": [ @@ -2421,7 +2460,7 @@ }, { "cell_type": "code", - "execution_count": 143, + "execution_count": 146, "metadata": {}, "outputs": [], "source": [ @@ -2437,7 +2476,7 @@ }, { "cell_type": "code", - "execution_count": 144, + "execution_count": 147, "metadata": {}, "outputs": [], "source": [ @@ -2458,7 +2497,7 @@ }, { "cell_type": "code", - "execution_count": 145, + "execution_count": 148, "metadata": {}, "outputs": [], "source": [ @@ -2480,7 +2519,7 @@ }, { "cell_type": "code", - "execution_count": 146, + "execution_count": 149, "metadata": {}, "outputs": [], "source": [ @@ -2501,7 +2540,7 @@ }, { "cell_type": "code", - "execution_count": 147, + "execution_count": 150, "metadata": {}, "outputs": [], "source": [ @@ -2554,7 +2593,7 @@ }, { "cell_type": "code", - "execution_count": 148, + "execution_count": 151, "metadata": {}, "outputs": [], "source": [ @@ -2579,7 +2618,7 @@ }, { "cell_type": "code", - "execution_count": 149, + "execution_count": 152, "metadata": {}, "outputs": [], "source": [ @@ -2612,7 +2651,7 @@ }, { "cell_type": "code", - "execution_count": 150, + "execution_count": 153, "metadata": {}, "outputs": [], "source": [ @@ -2623,7 +2662,7 @@ }, { "cell_type": "code", - "execution_count": 151, + "execution_count": 154, "metadata": {}, "outputs": [], "source": [ @@ -2639,7 +2678,7 @@ }, { "cell_type": "code", - "execution_count": 152, + "execution_count": 155, "metadata": {}, "outputs": [], "source": [ @@ -2655,7 +2694,7 @@ }, { "cell_type": "code", - "execution_count": 153, + "execution_count": 156, "metadata": {}, "outputs": [], "source": [ @@ -2671,7 +2710,7 @@ }, { "cell_type": "code", - "execution_count": 154, + "execution_count": 157, "metadata": {}, "outputs": [], "source": [ @@ -2694,7 +2733,7 @@ }, { "cell_type": "code", - "execution_count": 155, + "execution_count": 158, "metadata": {}, "outputs": [], "source": [