Skip to content

Commit 7b316c9

Browse files
committed
fix noisy_peak signature in example-notebook.ipynb
1 parent cb318bc commit 7b316c9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

example-notebook.ipynb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
"source": [
105105
"# The end condition is when the \"loss\" is less than 0.01. In the context of the\n",
106106
"# 1D learner this means that we will resolve features in 'func' with width 0.01 or wider.\n",
107-
"runner = adaptive.Runner(learner, goal=lambda l: l.loss() < 0.01, tasks=4)\n",
107+
"runner = adaptive.Runner(learner, goal=lambda l: l.loss() < 0.01)\n",
108108
"runner.live_info()"
109109
]
110110
},
@@ -312,9 +312,11 @@
312312
"metadata": {},
313313
"outputs": [],
314314
"source": [
315-
"def noisy_peak(x, sigma=0, peak_width=0.05, offset=-0.5):\n",
315+
"def noisy_peak(seed_x, sigma=0, peak_width=0.05, offset=-0.5):\n",
316+
" seed, x = seed_x\n",
316317
" y = x ** 3 - x + 3 * peak_width ** 2 / (peak_width ** 2 + (x - offset) ** 2)\n",
317-
" noise = np.random.normal(0, sigma)\n",
318+
" rng = np.random.RandomState(int(seed))\n",
319+
" noise = rng.normal(scale=sigma)\n",
318320
" return y + noise"
319321
]
320322
},
@@ -332,7 +334,7 @@
332334
"outputs": [],
333335
"source": [
334336
"xs = np.linspace(-2, 2, 500)\n",
335-
"ys = noisy_peak(xs, sigma=0)\n",
337+
"ys = [noisy_peak((seed, x), sigma=0) for seed, x in enumerate(xs)]\n",
336338
"hv.Path((xs, ys))"
337339
]
338340
},
@@ -349,7 +351,7 @@
349351
"metadata": {},
350352
"outputs": [],
351353
"source": [
352-
"ys = [noisy_peak(x, sigma=1) for x in xs]\n",
354+
"ys = [noisy_peak((seed, x), sigma=1) for seed, x in enumerate(xs)]\n",
353355
"hv.Path((xs, ys))"
354356
]
355357
},

0 commit comments

Comments
 (0)