Browse code

small fixes in the notebook

Bas Nijholt authored on 16/02/2018 16:02:33 • Joseph Weston committed on 16/02/2018 16:48:29
Showing 1 changed files
... ...
@@ -462,7 +462,7 @@
462 462
    "metadata": {},
463 463
    "outputs": [],
464 464
    "source": [
465
-    "def f(x, offset):\n",
465
+    "def f(x, offset=0):\n",
466 466
     "    a = 0.01\n",
467 467
     "    return x + a**2 / (a**2 + (x - offset)**2)\n",
468 468
     "\n",
... ...
@@ -470,7 +470,8 @@
470 470
     "            bounds=(-1, 1)) for i in range(10)]\n",
471 471
     "\n",
472 472
     "bal_learner = adaptive.BalancingLearner(learners)\n",
473
-    "runner = adaptive.Runner(bal_learner, goal=lambda l: l.loss() < 0.01)"
473
+    "runner = adaptive.Runner(bal_learner, goal=lambda l: l.loss() < 0.01)\n",
474
+    "runner.live_info()"
474 475
    ]
475 476
   },
476 477
   {
... ...
@@ -618,7 +619,8 @@
618 619
     "executor = ProcessPoolExecutor(max_workers=4)\n",
619 620
     "\n",
620 621
     "learner = adaptive.Learner1D(f, bounds=(-1, 1))\n",
621
-    "runner = adaptive.Runner(learner, executor=executor, goal=lambda l: l.loss() < 0.1)\n",
622
+    "runner = adaptive.Runner(learner, executor=executor, goal=lambda l: l.loss() < 0.05)\n",
623
+    "runner.live_info()\n",
622 624
     "runner.live_plot()"
623 625
    ]
624 626
   },
... ...
@@ -642,7 +644,8 @@
642 644
     "client[:].use_cloudpickle()\n",
643 645
     "\n",
644 646
     "learner = adaptive.Learner1D(f, bounds=(-1, 1))\n",
645
-    "runner = adaptive.Runner(learner, executor=client, goal=lambda l: l.loss() < 0.1)\n",
647
+    "runner = adaptive.Runner(learner, executor=client, goal=lambda l: l.loss() < 0.01)\n",
648
+    "runner.live_info()\n",
646 649
     "runner.live_plot()"
647 650
    ]
648 651
   },
... ...
@@ -693,7 +696,16 @@
693 696
    "metadata": {},
694 697
    "outputs": [],
695 698
    "source": [
696
-    "runner.task.cancel()"
699
+    "runner.cancel()"
700
+   ]
701
+  },
702
+  {
703
+   "cell_type": "code",
704
+   "execution_count": null,
705
+   "metadata": {},
706
+   "outputs": [],
707
+   "source": [
708
+    "print(runner.status())"
697 709
    ]
698 710
   },
699 711
   {
... ...
@@ -789,7 +801,7 @@
789 801
     "learner = adaptive.Learner1D(f, bounds=(-1, 1))\n",
790 802
     "runner = adaptive.Runner(learner, goal=lambda l: l.loss() < 0.1,\n",
791 803
     "                         log=True)\n",
792
-    "runner.live_plot()"
804
+    "runner.live_info()"
793 805
    ]
794 806
   },
795 807
   {