From 8db416a2d34bb0d5ab197c4ed44b29d7e56f0fb8 Mon Sep 17 00:00:00 2001 From: Thomas Morris Date: Thu, 12 Oct 2023 16:41:34 -0400 Subject: [PATCH] update syntax in notebooks --- docs/source/tutorials/Untitled.ipynb | 72 ---------------- docs/source/tutorials/Untitled1.ipynb | 92 --------------------- docs/source/tutorials/himmelblau.ipynb | 2 - docs/source/tutorials/hyperparameters.ipynb | 18 ++-- docs/source/tutorials/passive-dofs.ipynb | 59 +++---------- 5 files changed, 22 insertions(+), 221 deletions(-) delete mode 100644 docs/source/tutorials/Untitled.ipynb delete mode 100644 docs/source/tutorials/Untitled1.ipynb diff --git a/docs/source/tutorials/Untitled.ipynb b/docs/source/tutorials/Untitled.ipynb deleted file mode 100644 index d833089..0000000 --- a/docs/source/tutorials/Untitled.ipynb +++ /dev/null @@ -1,72 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "id": "9b72e238-f9c5-44ff-b519-63cdbfc8db3b", - "metadata": {}, - "outputs": [], - "source": [ - "from bloptools.utils import functions\n", - "from bloptools.bayesian import DOF, Agent, BrownianMotion, Objective\n", - "\n", - "\n", - "dofs = [\n", - " DOF(name=\"x1\", limits=(-5.0, 5.0)),\n", - " DOF(name=\"x2\", limits=(-5.0, 5.0)),\n", - " DOF(name=\"x3\", limits=(-5.0, 5.0), active=False),\n", - " DOF(BrownianMotion(name=\"brownian1\"), read_only=True),\n", - " DOF(BrownianMotion(name=\"brownian2\"), read_only=True, active=False),\n", - "]\n", - "\n", - "objectives = [\n", - " Objective(key=\"himmelblau\", minimize=True),\n", - "]\n", - "\n", - "agent = Agent(\n", - " dofs=dofs,\n", - " objectives=objectives,\n", - " digestion=functions.constrained_himmelblau_digestion,\n", - " db=db,\n", - " verbose=True,\n", - " tolerate_acquisition_errors=False,\n", - ")\n", - "\n", - "RE(agent.learn(\"qr\", n=32))\n", - "\n", - "agent.plot_objectives()\n", - "agent.plot_acquisition()\n", - "agent.plot_validity()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5b54b7c0-f1b2-4544-84fb-b581fb93f5d9", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/docs/source/tutorials/Untitled1.ipynb b/docs/source/tutorials/Untitled1.ipynb deleted file mode 100644 index 60a6f5b..0000000 --- a/docs/source/tutorials/Untitled1.ipynb +++ /dev/null @@ -1,92 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "id": "bb7b2eff-7c38-4a50-9a0f-9c27bd7cfc15", - "metadata": {}, - "outputs": [], - "source": [ - "from bloptools.utils import prepare_re_env\n", - "\n", - "%run -i $prepare_re_env.__file__ --db-type=temp\n", - "from bloptools.utils import functions\n", - "from bloptools.bayesian import DOF, Agent, BrownianMotion, Objective" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5e55ada4-bbab-48d0-8ba0-5c9b4880b363", - "metadata": {}, - "outputs": [], - "source": [ - "dofs = [\n", - " DOF(name=\"x1\", limits=(-5.0, 5.0)),\n", - " DOF(name=\"x2\", limits=(-5.0, 5.0)),\n", - " DOF(name=\"x3\", limits=(-5.0, 5.0), active=False),\n", - " DOF(BrownianMotion(name=\"brownian1\"), read_only=True),\n", - " DOF(BrownianMotion(name=\"brownian2\"), read_only=True, active=False),\n", - "]\n", - "\n", - "objectives = [\n", - " Objective(key=\"himmelblau\", minimize=True),\n", - "]\n", - "\n", - "agent = Agent(\n", - " dofs=dofs,\n", - " objectives=objectives,\n", - " digestion=functions.constrained_himmelblau_digestion,\n", - " db=db,\n", - " verbose=True,\n", - " tolerate_acquisition_errors=False,\n", - ")\n", - "\n", - "RE(agent.learn(\"qr\", n=32))\n", - "\n", - "agent.plot_objectives()\n", - "agent.plot_acquisition()\n", - "agent.plot_validity()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6793103c-684d-4e22-9ccd-ef0306cd80bf", - "metadata": {}, - "outputs": [], - "source": [ - "%debug" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "63d9e7b5-03a3-4893-80ac-0611a4ab26e5", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/docs/source/tutorials/himmelblau.ipynb b/docs/source/tutorials/himmelblau.ipynb index 54fa840..580684e 100644 --- a/docs/source/tutorials/himmelblau.ipynb +++ b/docs/source/tutorials/himmelblau.ipynb @@ -74,8 +74,6 @@ "dofs = [\n", " DOF(name=\"x1\", limits=(-6, 6)),\n", " DOF(name=\"x2\", limits=(-6, 6)),\n", - " DOF(BrownianMotion(name=\"brownian1\"), read_only=True),\n", - " DOF(BrownianMotion(name=\"brownian2\"), read_only=True),\n", "]" ] }, diff --git a/docs/source/tutorials/hyperparameters.ipynb b/docs/source/tutorials/hyperparameters.ipynb index e8c42b9..568c73c 100644 --- a/docs/source/tutorials/hyperparameters.ipynb +++ b/docs/source/tutorials/hyperparameters.ipynb @@ -72,21 +72,21 @@ "\n", "%run -i $prepare_re_env.__file__ --db-type=temp\n", "\n", - "from bloptools import devices\n", - "from bloptools.bayesian import Agent\n", + "from bloptools.bayesian import DOF, Objective, Agent\n", "\n", "dofs = [\n", - " {\"device\": devices.DOF(name=\"x1\"), \"limits\": (-5, 5), \"kind\": \"active\"},\n", - " {\"device\": devices.DOF(name=\"x2\"), \"limits\": (-5, 5), \"kind\": \"active\"},\n", + " DOF(name=\"x1\", limits=(-6, 6)),\n", + " DOF(name=\"x2\", limits=(-6, 6)),\n", "]\n", "\n", - "tasks = [\n", - " {\"key\": \"booth\", \"kind\": \"minimize\"},\n", + "objectives = [\n", + " Objective(key=\"booth\", minimize=True),\n", "]\n", "\n", + "\n", "agent = Agent(\n", " dofs=dofs,\n", - " tasks=tasks,\n", + " objectives=objectives,\n", " digestion=digestion,\n", " db=db,\n", ")\n", @@ -131,7 +131,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3.11.4 64-bit", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -145,7 +145,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.5" + "version": "3.11.4" }, "vscode": { "interpreter": { diff --git a/docs/source/tutorials/passive-dofs.ipynb b/docs/source/tutorials/passive-dofs.ipynb index 3f88734..3ea0f19 100644 --- a/docs/source/tutorials/passive-dofs.ipynb +++ b/docs/source/tutorials/passive-dofs.ipynb @@ -43,74 +43,41 @@ "from bloptools.utils import functions\n", "from bloptools.bayesian import DOF, Agent, BrownianMotion, Objective\n", "\n", - "\n", - "@pytest.mark.test_func\n", - "def test_passive_dofs(RE, db):\n", - " dofs = [\n", - " DOF(name=\"x1\", limits=(-5.0, 5.0)),\n", - " DOF(name=\"x2\", limits=(-5.0, 5.0)),\n", - " DOF(name=\"x3\", limits=(-5.0, 5.0), active=False),\n", - " DOF(BrownianMotion(name=\"brownian1\"), read_only=True),\n", - " DOF(BrownianMotion(name=\"brownian2\"), read_only=True, active=False),\n", - " ]\n", - "\n", - " objectives = [\n", - " Objective(key=\"himmelblau\", minimize=True),\n", - " ]\n", - "\n", - " agent = Agent(\n", - " dofs=dofs,\n", - " objectives=objectives,\n", - " digestion=functions.constrained_himmelblau_digestion,\n", - " db=db,\n", - " verbose=True,\n", - " tolerate_acquisition_errors=False,\n", - " )\n", - "\n", - " RE(agent.learn(\"qr\", n=32))\n", - "\n", - " agent.plot_objectives()\n", - " agent.plot_acquisition()\n", - " agent.plot_validity()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c88d54d9-c600-41ad-9b3e-53af510d8760", - "metadata": {}, - "outputs": [], - "source": [ "dofs = [\n", " DOF(name=\"x1\", limits=(-5.0, 5.0)),\n", " DOF(name=\"x2\", limits=(-5.0, 5.0)),\n", + " DOF(name=\"x3\", limits=(-5.0, 5.0), active=False),\n", " DOF(BrownianMotion(name=\"brownian1\"), read_only=True),\n", - " DOF(BrownianMotion(name=\"brownian2\"), read_only=True),\n", + " DOF(BrownianMotion(name=\"brownian2\"), read_only=True, active=False),\n", "]\n", "\n", "objectives = [\n", - " Objective(key=\"styblinksi-tang\", minimize=True),\n", + " Objective(key=\"himmelblau\", minimize=True),\n", "]\n", "\n", "agent = Agent(\n", " dofs=dofs,\n", " objectives=objectives,\n", - " digestion=digestion,\n", + " digestion=functions.constrained_himmelblau_digestion,\n", " db=db,\n", " verbose=True,\n", " tolerate_acquisition_errors=False,\n", - ")" + ")\n", + "\n", + "RE(agent.learn(\"qr\", n=32))\n", + "\n", + "agent.plot_objectives()\n", + "agent.plot_acquisition()\n", + "agent.plot_validity()" ] }, { "cell_type": "code", "execution_count": null, - "id": "ee813fab-1114-46ea-81f9-35c8292b2ba4", + "id": "990a877e-f533-419c-bf5d-569ad7e72c6b", "metadata": {}, "outputs": [], - "source": [ - "agent.plot_objectives()" - ] + "source": [] } ], "metadata": {