Skip to content

Commit

Permalink
update syntax in notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Morris committed Oct 12, 2023
1 parent 05b8e73 commit 8db416a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 221 deletions.
72 changes: 0 additions & 72 deletions docs/source/tutorials/Untitled.ipynb

This file was deleted.

92 changes: 0 additions & 92 deletions docs/source/tutorials/Untitled1.ipynb

This file was deleted.

2 changes: 0 additions & 2 deletions docs/source/tutorials/himmelblau.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"]"
]
},
Expand Down
18 changes: 9 additions & 9 deletions docs/source/tutorials/hyperparameters.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -131,7 +131,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.11.4 64-bit",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -145,7 +145,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
"version": "3.11.4"
},
"vscode": {
"interpreter": {
Expand Down
59 changes: 13 additions & 46 deletions docs/source/tutorials/passive-dofs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 8db416a

Please sign in to comment.