From 4eb68a8b7a1cad33d60a3d626cc61c3abab3a6de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Geron?= Date: Mon, 22 Nov 2021 10:18:02 +1300 Subject: [PATCH] Replace .format with f-strings --- 04_training_linear_models.ipynb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/04_training_linear_models.ipynb b/04_training_linear_models.ipynb index 9b1246e..0eb08f7 100644 --- a/04_training_linear_models.ipynb +++ b/04_training_linear_models.ipynb @@ -346,7 +346,7 @@ " plt.xlabel(\"$x_1$\")\n", " plt.axis([0, 2, 0, 15])\n", " plt.grid()\n", - " plt.title(r\"$\\eta = {}$\".format(eta))\n", + " plt.title(fr\"$\\eta = {eta}$\")\n", " return theta_path\n", "\n", "np.random.seed(42)\n", @@ -820,7 +820,7 @@ " model.fit(X, y)\n", " y_new_regul = model.predict(X_new)\n", " plt.plot(X_new, y_new_regul, style, linewidth=2,\n", - " label=r\"$\\alpha = {}$\".format(alpha))\n", + " label=fr\"$\\alpha = {alpha}$\")\n", " plt.legend(loc=\"upper left\")\n", " plt.xlabel(\"$x_1$\")\n", " plt.axis([0, 3, 0, 3.5])\n", @@ -960,7 +960,7 @@ " ax.plot(path_N[:, 0], path_N[:, 1], \"y--\")\n", " ax.plot(0, 0, \"ys\")\n", " ax.plot(t1_min, t2_min, \"ys\")\n", - " ax.set_title(r\"$\\ell_{}$ penalty\".format(i + 1))\n", + " ax.set_title(fr\"$\\ell_{i + 1}$ penalty\")\n", " ax.axis([t1a, t1b, t2a, t2b])\n", " if i == 1:\n", " ax.set_xlabel(r\"$\\theta_1$\")\n",