Browse code

add a example using 'distributed' to the notebook

Bas Nijholt authored on 19/02/2018 11:57:38
Showing 1 changed files
... ...
@@ -651,6 +651,29 @@
651 651
     "runner.live_plot()"
652 652
    ]
653 653
   },
654
+  {
655
+   "cell_type": "markdown",
656
+   "metadata": {},
657
+   "source": [
658
+    "### distributed"
659
+   ]
660
+  },
661
+  {
662
+   "cell_type": "code",
663
+   "execution_count": null,
664
+   "metadata": {},
665
+   "outputs": [],
666
+   "source": [
667
+    "import distributed\n",
668
+    "\n",
669
+    "client = distributed.Client()\n",
670
+    "\n",
671
+    "learner = adaptive.Learner1D(f, bounds=(-1, 1))\n",
672
+    "runner = adaptive.Runner(learner, executor=client, goal=lambda l: l.loss() < 0.01)\n",
673
+    "runner.live_info()\n",
674
+    "runner.live_plot()"
675
+   ]
676
+  },
654 677
   {
655 678
    "cell_type": "markdown",
656 679
    "metadata": {},