Make font sizes consistent across notebooks

This commit is contained in:
Aurélien Geron
2021-11-27 23:03:26 +13:00
parent e72b210d97
commit 52d4f0a8c6
9 changed files with 141 additions and 156 deletions

View File

@@ -86,7 +86,7 @@
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"plt.rc('font', size=12)\n",
"plt.rc('font', size=14)\n",
"plt.rc('axes', labelsize=14, titlesize=14)\n",
"plt.rc('legend', fontsize=14)\n",
"plt.rc('xtick',labelsize=10)\n",
@@ -689,7 +689,7 @@
"plt.ylabel('True Positive Rate (Recall)')\n",
"plt.grid()\n",
"plt.axis([0, 1, 0, 1])\n",
"plt.legend(loc=\"lower right\")\n",
"plt.legend(loc=\"lower right\", fontsize=13)\n",
"save_fig(\"roc_curve_plot\")\n",
"\n",
"plt.show()"
@@ -1033,6 +1033,7 @@
"from sklearn.metrics import ConfusionMatrixDisplay\n",
"\n",
"y_train_pred = cross_val_predict(sgd_clf, X_train_scaled, y_train, cv=3)\n",
"plt.rc('font', size=9) # not in the book make the text smaller\n",
"ConfusionMatrixDisplay.from_predictions(y_train, y_train_pred)\n",
"plt.show()"
]
@@ -1043,6 +1044,7 @@
"metadata": {},
"outputs": [],
"source": [
"plt.rc('font', size=10) # not in the book\n",
"ConfusionMatrixDisplay.from_predictions(y_train, y_train_pred,\n",
" normalize=\"true\", values_format=\".0%\")\n",
"plt.show()"
@@ -1055,6 +1057,7 @@
"outputs": [],
"source": [
"sample_weight = (y_train_pred != y_train)\n",
"plt.rc('font', size=10) # not in the book\n",
"ConfusionMatrixDisplay.from_predictions(y_train, y_train_pred,\n",
" sample_weight=sample_weight,\n",
" normalize=\"true\", values_format=\".0%\")\n",
@@ -1076,8 +1079,10 @@
"source": [
"# not in the book this code generates Figure 39\n",
"fig, axs = plt.subplots(nrows=1, ncols=2, figsize=(9, 4))\n",
"plt.rc('font', size=9)\n",
"ConfusionMatrixDisplay.from_predictions(y_train, y_train_pred, ax=axs[0])\n",
"axs[0].set_title(\"Confusion matrix\")\n",
"plt.rc('font', size=10)\n",
"ConfusionMatrixDisplay.from_predictions(y_train, y_train_pred, ax=axs[1],\n",
" normalize=\"true\", values_format=\".0%\")\n",
"axs[1].set_title(\"CM normalized by row\")\n",
@@ -1093,6 +1098,7 @@
"source": [
"# not in the book this code generates Figure 310\n",
"fig, axs = plt.subplots(nrows=1, ncols=2, figsize=(9, 4))\n",
"plt.rc('font', size=10)\n",
"ConfusionMatrixDisplay.from_predictions(y_train, y_train_pred, ax=axs[0],\n",
" sample_weight=sample_weight,\n",
" normalize=\"true\", values_format=\".0%\")\n",
@@ -1102,7 +1108,8 @@
" normalize=\"pred\", values_format=\".0%\")\n",
"axs[1].set_title(\"Errors normalized by column\")\n",
"save_fig(\"confusion_matrix_plot_2\")\n",
"plt.show()"
"plt.show()\n",
"plt.rc('font', size=14) # make fonts great again"
]
},
{
@@ -1293,36 +1300,6 @@
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Extra Material — Calibrating Estimated Probabilities"
]
},
{
"cell_type": "code",
"execution_count": 89,
"metadata": {},
"outputs": [],
"source": [
"# TODO"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
@@ -1353,7 +1330,7 @@
},
{
"cell_type": "code",
"execution_count": 90,
"execution_count": 89,
"metadata": {},
"outputs": [],
"source": [
@@ -1379,7 +1356,7 @@
},
{
"cell_type": "code",
"execution_count": 91,
"execution_count": 90,
"metadata": {},
"outputs": [],
"source": [
@@ -1394,7 +1371,7 @@
},
{
"cell_type": "code",
"execution_count": 92,
"execution_count": 91,
"metadata": {},
"outputs": [],
"source": [
@@ -1403,7 +1380,7 @@
},
{
"cell_type": "code",
"execution_count": 93,
"execution_count": 92,
"metadata": {},
"outputs": [],
"source": [
@@ -1419,7 +1396,7 @@
},
{
"cell_type": "code",
"execution_count": 94,
"execution_count": 93,
"metadata": {},
"outputs": [],
"source": [
@@ -1458,7 +1435,7 @@
},
{
"cell_type": "code",
"execution_count": 95,
"execution_count": 94,
"metadata": {},
"outputs": [],
"source": [
@@ -1467,7 +1444,7 @@
},
{
"cell_type": "code",
"execution_count": 96,
"execution_count": 95,
"metadata": {},
"outputs": [],
"source": [
@@ -1486,7 +1463,7 @@
},
{
"cell_type": "code",
"execution_count": 97,
"execution_count": 96,
"metadata": {},
"outputs": [],
"source": [
@@ -1519,7 +1496,7 @@
},
{
"cell_type": "code",
"execution_count": 98,
"execution_count": 97,
"metadata": {},
"outputs": [],
"source": [
@@ -1544,7 +1521,7 @@
},
{
"cell_type": "code",
"execution_count": 99,
"execution_count": 98,
"metadata": {},
"outputs": [],
"source": [
@@ -1562,7 +1539,7 @@
},
{
"cell_type": "code",
"execution_count": 100,
"execution_count": 99,
"metadata": {},
"outputs": [],
"source": [
@@ -1571,7 +1548,7 @@
},
{
"cell_type": "code",
"execution_count": 101,
"execution_count": 100,
"metadata": {},
"outputs": [],
"source": [
@@ -1587,7 +1564,7 @@
},
{
"cell_type": "code",
"execution_count": 102,
"execution_count": 101,
"metadata": {},
"outputs": [],
"source": [
@@ -1603,7 +1580,7 @@
},
{
"cell_type": "code",
"execution_count": 103,
"execution_count": 102,
"metadata": {
"tags": []
},
@@ -1643,7 +1620,7 @@
},
{
"cell_type": "code",
"execution_count": 104,
"execution_count": 103,
"metadata": {},
"outputs": [],
"source": [
@@ -1667,7 +1644,7 @@
},
{
"cell_type": "code",
"execution_count": 105,
"execution_count": 104,
"metadata": {},
"outputs": [],
"source": [
@@ -1690,7 +1667,7 @@
},
{
"cell_type": "code",
"execution_count": 106,
"execution_count": 105,
"metadata": {},
"outputs": [],
"source": [
@@ -1730,7 +1707,7 @@
},
{
"cell_type": "code",
"execution_count": 107,
"execution_count": 106,
"metadata": {},
"outputs": [],
"source": [
@@ -1747,7 +1724,7 @@
},
{
"cell_type": "code",
"execution_count": 108,
"execution_count": 107,
"metadata": {},
"outputs": [],
"source": [
@@ -1756,7 +1733,7 @@
},
{
"cell_type": "code",
"execution_count": 109,
"execution_count": 108,
"metadata": {},
"outputs": [],
"source": [
@@ -1786,7 +1763,7 @@
},
{
"cell_type": "code",
"execution_count": 110,
"execution_count": 109,
"metadata": {},
"outputs": [],
"source": [
@@ -1811,7 +1788,7 @@
},
{
"cell_type": "code",
"execution_count": 111,
"execution_count": 110,
"metadata": {},
"outputs": [],
"source": [
@@ -1827,7 +1804,7 @@
},
{
"cell_type": "code",
"execution_count": 112,
"execution_count": 111,
"metadata": {},
"outputs": [],
"source": [
@@ -1836,7 +1813,7 @@
},
{
"cell_type": "code",
"execution_count": 113,
"execution_count": 112,
"metadata": {},
"outputs": [],
"source": [
@@ -1845,7 +1822,7 @@
},
{
"cell_type": "code",
"execution_count": 114,
"execution_count": 113,
"metadata": {},
"outputs": [],
"source": [
@@ -1868,7 +1845,7 @@
},
{
"cell_type": "code",
"execution_count": 115,
"execution_count": 114,
"metadata": {},
"outputs": [],
"source": [
@@ -1890,7 +1867,7 @@
},
{
"cell_type": "code",
"execution_count": 116,
"execution_count": 115,
"metadata": {},
"outputs": [],
"source": [
@@ -1899,7 +1876,7 @@
},
{
"cell_type": "code",
"execution_count": 117,
"execution_count": 116,
"metadata": {},
"outputs": [],
"source": [
@@ -1919,7 +1896,7 @@
},
{
"cell_type": "code",
"execution_count": 118,
"execution_count": 117,
"metadata": {},
"outputs": [],
"source": [
@@ -1943,7 +1920,7 @@
},
{
"cell_type": "code",
"execution_count": 119,
"execution_count": 118,
"metadata": {},
"outputs": [],
"source": [
@@ -1960,7 +1937,7 @@
},
{
"cell_type": "code",
"execution_count": 120,
"execution_count": 119,
"metadata": {},
"outputs": [],
"source": [
@@ -1976,7 +1953,7 @@
},
{
"cell_type": "code",
"execution_count": 121,
"execution_count": 120,
"metadata": {},
"outputs": [],
"source": [
@@ -1993,7 +1970,7 @@
},
{
"cell_type": "code",
"execution_count": 122,
"execution_count": 121,
"metadata": {},
"outputs": [],
"source": [
@@ -2010,7 +1987,7 @@
},
{
"cell_type": "code",
"execution_count": 123,
"execution_count": 122,
"metadata": {},
"outputs": [],
"source": [
@@ -2034,7 +2011,7 @@
},
{
"cell_type": "code",
"execution_count": 124,
"execution_count": 123,
"metadata": {},
"outputs": [],
"source": [
@@ -2061,7 +2038,7 @@
},
{
"cell_type": "code",
"execution_count": 125,
"execution_count": 124,
"metadata": {},
"outputs": [],
"source": [
@@ -2095,7 +2072,7 @@
},
{
"cell_type": "code",
"execution_count": 126,
"execution_count": 125,
"metadata": {},
"outputs": [],
"source": [
@@ -2105,7 +2082,7 @@
},
{
"cell_type": "code",
"execution_count": 127,
"execution_count": 126,
"metadata": {},
"outputs": [],
"source": [
@@ -2139,7 +2116,7 @@
},
{
"cell_type": "code",
"execution_count": 128,
"execution_count": 127,
"metadata": {},
"outputs": [],
"source": [
@@ -2166,7 +2143,7 @@
},
{
"cell_type": "code",
"execution_count": 129,
"execution_count": 128,
"metadata": {},
"outputs": [],
"source": [
@@ -2182,7 +2159,7 @@
},
{
"cell_type": "code",
"execution_count": 130,
"execution_count": 129,
"metadata": {},
"outputs": [],
"source": [
@@ -2192,7 +2169,7 @@
},
{
"cell_type": "code",
"execution_count": 131,
"execution_count": 130,
"metadata": {},
"outputs": [],
"source": [
@@ -2201,7 +2178,7 @@
},
{
"cell_type": "code",
"execution_count": 132,
"execution_count": 131,
"metadata": {},
"outputs": [],
"source": [
@@ -2217,7 +2194,7 @@
},
{
"cell_type": "code",
"execution_count": 133,
"execution_count": 132,
"metadata": {},
"outputs": [],
"source": [
@@ -2231,7 +2208,7 @@
},
{
"cell_type": "code",
"execution_count": 134,
"execution_count": 133,
"metadata": {},
"outputs": [],
"source": [
@@ -2248,7 +2225,7 @@
},
{
"cell_type": "code",
"execution_count": 135,
"execution_count": 134,
"metadata": {},
"outputs": [],
"source": [
@@ -2257,7 +2234,7 @@
},
{
"cell_type": "code",
"execution_count": 136,
"execution_count": 135,
"metadata": {},
"outputs": [],
"source": [
@@ -2273,7 +2250,7 @@
},
{
"cell_type": "code",
"execution_count": 137,
"execution_count": 136,
"metadata": {},
"outputs": [],
"source": [
@@ -2291,7 +2268,7 @@
},
{
"cell_type": "code",
"execution_count": 138,
"execution_count": 137,
"metadata": {},
"outputs": [],
"source": [
@@ -2307,7 +2284,7 @@
},
{
"cell_type": "code",
"execution_count": 139,
"execution_count": 138,
"metadata": {},
"outputs": [],
"source": [
@@ -2316,7 +2293,7 @@
},
{
"cell_type": "code",
"execution_count": 140,
"execution_count": 139,
"metadata": {},
"outputs": [],
"source": [
@@ -2339,7 +2316,7 @@
},
{
"cell_type": "code",
"execution_count": 141,
"execution_count": 140,
"metadata": {},
"outputs": [],
"source": [
@@ -2356,7 +2333,7 @@
},
{
"cell_type": "code",
"execution_count": 142,
"execution_count": 141,
"metadata": {},
"outputs": [],
"source": [
@@ -2372,7 +2349,7 @@
},
{
"cell_type": "code",
"execution_count": 143,
"execution_count": 142,
"metadata": {},
"outputs": [],
"source": [
@@ -2395,7 +2372,7 @@
},
{
"cell_type": "code",
"execution_count": 144,
"execution_count": 143,
"metadata": {},
"outputs": [],
"source": [
@@ -2419,7 +2396,7 @@
},
{
"cell_type": "code",
"execution_count": 145,
"execution_count": 144,
"metadata": {},
"outputs": [],
"source": [
@@ -2438,7 +2415,7 @@
},
{
"cell_type": "code",
"execution_count": 146,
"execution_count": 145,
"metadata": {},
"outputs": [],
"source": [
@@ -2454,7 +2431,7 @@
},
{
"cell_type": "code",
"execution_count": 147,
"execution_count": 146,
"metadata": {},
"outputs": [],
"source": [
@@ -2478,7 +2455,7 @@
},
{
"cell_type": "code",
"execution_count": 148,
"execution_count": 147,
"metadata": {},
"outputs": [],
"source": [
@@ -2494,7 +2471,7 @@
},
{
"cell_type": "code",
"execution_count": 149,
"execution_count": 148,
"metadata": {},
"outputs": [],
"source": [
@@ -2515,7 +2492,7 @@
},
{
"cell_type": "code",
"execution_count": 150,
"execution_count": 149,
"metadata": {},
"outputs": [],
"source": [
@@ -2537,7 +2514,7 @@
},
{
"cell_type": "code",
"execution_count": 151,
"execution_count": 150,
"metadata": {},
"outputs": [],
"source": [
@@ -2558,7 +2535,7 @@
},
{
"cell_type": "code",
"execution_count": 152,
"execution_count": 151,
"metadata": {},
"outputs": [],
"source": [
@@ -2611,7 +2588,7 @@
},
{
"cell_type": "code",
"execution_count": 153,
"execution_count": 152,
"metadata": {},
"outputs": [],
"source": [
@@ -2636,7 +2613,7 @@
},
{
"cell_type": "code",
"execution_count": 154,
"execution_count": 153,
"metadata": {},
"outputs": [],
"source": [
@@ -2669,7 +2646,7 @@
},
{
"cell_type": "code",
"execution_count": 155,
"execution_count": 154,
"metadata": {},
"outputs": [],
"source": [
@@ -2680,7 +2657,7 @@
},
{
"cell_type": "code",
"execution_count": 156,
"execution_count": 155,
"metadata": {},
"outputs": [],
"source": [
@@ -2696,7 +2673,7 @@
},
{
"cell_type": "code",
"execution_count": 157,
"execution_count": 156,
"metadata": {},
"outputs": [],
"source": [
@@ -2712,7 +2689,7 @@
},
{
"cell_type": "code",
"execution_count": 158,
"execution_count": 157,
"metadata": {},
"outputs": [],
"source": [
@@ -2728,7 +2705,7 @@
},
{
"cell_type": "code",
"execution_count": 159,
"execution_count": 158,
"metadata": {},
"outputs": [],
"source": [
@@ -2751,7 +2728,7 @@
},
{
"cell_type": "code",
"execution_count": 160,
"execution_count": 159,
"metadata": {},
"outputs": [],
"source": [