Browse code

2D: fixes in the notebook

Bas Nijholt authored on 14/09/2017 17:31:42
Showing 1 changed files
... ...
@@ -65,7 +65,7 @@
65 65
     "\n",
66 66
     "    a = 0.01\n",
67 67
     "    if wait:\n",
68
-    "        sleep(random())\n",
68
+    "        sleep(random()*10)\n",
69 69
     "    return x + a**2 / (a**2 + (x - offset)**2)"
70 70
    ]
71 71
   },
... ...
@@ -152,7 +152,7 @@
152 152
     "xs = np.linspace(-1.0, 1.0, len(learner.data))\n",
153 153
     "learner2.add_data(xs, map(partial(f, wait=False), xs))\n",
154 154
     "\n",
155
-    "learner2.plot()"
155
+    "learner.plot() + learner2.plot()"
156 156
    ]
157 157
   },
158 158
   {
... ...
@@ -193,7 +193,7 @@
193 193
    "metadata": {},
194 194
    "outputs": [],
195 195
    "source": [
196
-    "runner = adaptive.Runner(learner, goal=lambda l: l.loss() < 0.01, log=True)"
196
+    "runner = adaptive.Runner(learner, goal=lambda l: l.loss() < 0.01)"
197 197
    ]
198 198
   },
199 199
   {
... ...
@@ -207,11 +207,11 @@
207 207
     "from adaptive.learner import *\n",
208 208
     "\n",
209 209
     "def plot(self):\n",
210
-    "    tri = self.ip.tri\n",
210
+    "    tri = self.ip().tri\n",
211 211
     "    return hv.Contours([p for p in tri.points[tri.vertices]])\n",
212 212
     "\n",
213 213
     "def plot_poly(self):\n",
214
-    "    tri = self.ip.tri\n",
214
+    "    tri = self.ip().tri\n",
215 215
     "    return hv.Polygons([p for p in tri.points[tri.vertices]])\n",
216 216
     "\n",
217 217
     "\n",