|
104 | 104 | "source": [
|
105 | 105 | "# The end condition is when the \"loss\" is less than 0.01. In the context of the\n",
|
106 | 106 | "# 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", |
108 | 108 | "runner.live_info()"
|
109 | 109 | ]
|
110 | 110 | },
|
|
312 | 312 | "metadata": {},
|
313 | 313 | "outputs": [],
|
314 | 314 | "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", |
316 | 317 | " 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", |
318 | 320 | " return y + noise"
|
319 | 321 | ]
|
320 | 322 | },
|
|
332 | 334 | "outputs": [],
|
333 | 335 | "source": [
|
334 | 336 | "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", |
336 | 338 | "hv.Path((xs, ys))"
|
337 | 339 | ]
|
338 | 340 | },
|
|
349 | 351 | "metadata": {},
|
350 | 352 | "outputs": [],
|
351 | 353 | "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", |
353 | 355 | "hv.Path((xs, ys))"
|
354 | 356 | ]
|
355 | 357 | },
|
|
0 commit comments