diff --git a/01a_machine_learning.ipynb b/01a_machine_learning.ipynb index e8bff60..3df48ef 100755 --- a/01a_machine_learning.ipynb +++ b/01a_machine_learning.ipynb @@ -952,11 +952,11 @@ "# Generating the x axis\n", "x = np.linspace(0, 1, 100)\n", "plots = []\n", - "for p in range(len(params)):\n", - " poly = np.poly1d(params[p])\n", + "for ind, param in enumerate(params):\n", + " poly = np.poly1d(param)\n", " epsilon = np.random.uniform(-eps, eps, x.shape)\n", " y = poly(x) + epsilon\n", - " plots.append(scatter(x, y, title=\"Problem \"+(str(p+1))))" + " plots.append(scatter(x, y, title=\"Problem \"+(str(ind+1))))" ] }, { @@ -1051,11 +1051,11 @@ "# Generating the x axis\n", "x = np.linspace(0, 1, 100)\n", "plots = []\n", - "for p in range(len(noise_levels)):\n", + "for ind, noise_level in enumerate(noise_levels):\n", " poly = np.poly1d(params)\n", - " epsilon = np.random.uniform(-noise_levels[p],noise_levels[p],x.shape)\n", + " epsilon = np.random.uniform(-noise_level, noise_level, x.shape)\n", " y = poly(x) + epsilon\n", - " plots.append(scatter(x, y, title=\"Problem \"+(str(p+1))))" + " plots.append(scatter(x, y, title=\"Problem \"+(str(ind+1))))" ] }, { @@ -2908,4 +2908,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file