abbot 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- abbot-0.1.0/.github/workflows/publish.yml +52 -0
- abbot-0.1.0/.github/workflows/tests.yml +43 -0
- abbot-0.1.0/.gitignore +8 -0
- abbot-0.1.0/CITATION.cff +14 -0
- abbot-0.1.0/LICENSE +201 -0
- abbot-0.1.0/PKG-INFO +291 -0
- abbot-0.1.0/README.md +252 -0
- abbot-0.1.0/benchmarks/multi_fidelity.py +403 -0
- abbot-0.1.0/docs/API.md +819 -0
- abbot-0.1.0/docs/ARCHITECTURE.md +121 -0
- abbot-0.1.0/docs/ECOSYSTEM.md +201 -0
- abbot-0.1.0/docs/HOWTO.md +76 -0
- abbot-0.1.0/environment.yml +19 -0
- abbot-0.1.0/examples/01_lab_bo.ipynb +295 -0
- abbot-0.1.0/examples/02_multi_objective.ipynb +203 -0
- abbot-0.1.0/examples/03_composite_sbi.ipynb +237 -0
- abbot-0.1.0/examples/04_goal_bax.ipynb +209 -0
- abbot-0.1.0/examples/05_multi_fidelity.ipynb +328 -0
- abbot-0.1.0/examples/README.md +28 -0
- abbot-0.1.0/examples/_build_notebooks.py +574 -0
- abbot-0.1.0/examples/custom_models.py +152 -0
- abbot-0.1.0/pyproject.toml +66 -0
- abbot-0.1.0/src/abbot/__init__.py +159 -0
- abbot-0.1.0/src/abbot/acq_opt.py +206 -0
- abbot-0.1.0/src/abbot/analysis.py +256 -0
- abbot-0.1.0/src/abbot/composite.py +114 -0
- abbot-0.1.0/src/abbot/config.py +47 -0
- abbot-0.1.0/src/abbot/cost.py +265 -0
- abbot-0.1.0/src/abbot/diagnostics.py +374 -0
- abbot-0.1.0/src/abbot/experiment.py +365 -0
- abbot-0.1.0/src/abbot/feasibility.py +158 -0
- abbot-0.1.0/src/abbot/goal.py +261 -0
- abbot-0.1.0/src/abbot/history.py +255 -0
- abbot-0.1.0/src/abbot/interop/__init__.py +2 -0
- abbot-0.1.0/src/abbot/interop/sbi.py +78 -0
- abbot-0.1.0/src/abbot/interop/xopt.py +419 -0
- abbot-0.1.0/src/abbot/io.py +282 -0
- abbot-0.1.0/src/abbot/loop.py +180 -0
- abbot-0.1.0/src/abbot/model.py +851 -0
- abbot-0.1.0/src/abbot/models/__init__.py +1 -0
- abbot-0.1.0/src/abbot/models/ensemble.py +51 -0
- abbot-0.1.0/src/abbot/policy.py +1344 -0
- abbot-0.1.0/src/abbot/problem.py +1015 -0
- abbot-0.1.0/src/abbot/session.py +1669 -0
- abbot-0.1.0/src/abbot/supervision.py +593 -0
- abbot-0.1.0/src/abbot/ui/__init__.py +10 -0
- abbot-0.1.0/src/abbot/ui/__main__.py +5 -0
- abbot-0.1.0/src/abbot/ui/app.py +1020 -0
- abbot-0.1.0/src/abbot/ui/builder.py +140 -0
- abbot-0.1.0/src/abbot/ui/controller.py +197 -0
- abbot-0.1.0/src/abbot/ui/figures.py +158 -0
- abbot-0.1.0/src/abbot/usability.py +93 -0
- abbot-0.1.0/tests/test_analysis.py +195 -0
- abbot-0.1.0/tests/test_batch.py +175 -0
- abbot-0.1.0/tests/test_bax.py +159 -0
- abbot-0.1.0/tests/test_categories.py +293 -0
- abbot-0.1.0/tests/test_composite.py +84 -0
- abbot-0.1.0/tests/test_controller.py +155 -0
- abbot-0.1.0/tests/test_cost.py +292 -0
- abbot-0.1.0/tests/test_defaults.py +258 -0
- abbot-0.1.0/tests/test_diagnostics.py +366 -0
- abbot-0.1.0/tests/test_end_to_end.py +174 -0
- abbot-0.1.0/tests/test_ensemble_contract.py +44 -0
- abbot-0.1.0/tests/test_examples.py +34 -0
- abbot-0.1.0/tests/test_experiment_contract.py +127 -0
- abbot-0.1.0/tests/test_faults_vs_regions.py +386 -0
- abbot-0.1.0/tests/test_figures.py +91 -0
- abbot-0.1.0/tests/test_gest_policy.py +178 -0
- abbot-0.1.0/tests/test_goal.py +101 -0
- abbot-0.1.0/tests/test_inflight.py +168 -0
- abbot-0.1.0/tests/test_interop_xopt.py +131 -0
- abbot-0.1.0/tests/test_io.py +212 -0
- abbot-0.1.0/tests/test_mock_experiments.py +148 -0
- abbot-0.1.0/tests/test_model_generality.py +132 -0
- abbot-0.1.0/tests/test_multi_fidelity.py +507 -0
- abbot-0.1.0/tests/test_multitask.py +250 -0
- abbot-0.1.0/tests/test_objectives.py +263 -0
- abbot-0.1.0/tests/test_output_constraints.py +435 -0
- abbot-0.1.0/tests/test_pending.py +336 -0
- abbot-0.1.0/tests/test_prior_mean.py +132 -0
- abbot-0.1.0/tests/test_problem_spec.py +61 -0
- abbot-0.1.0/tests/test_quickstart.py +39 -0
- abbot-0.1.0/tests/test_run_errors.py +150 -0
- abbot-0.1.0/tests/test_sbi.py +102 -0
- abbot-0.1.0/tests/test_sbi_policy.py +131 -0
- abbot-0.1.0/tests/test_session.py +213 -0
- abbot-0.1.0/tests/test_simple_bo.py +94 -0
- abbot-0.1.0/tests/test_sources.py +266 -0
- abbot-0.1.0/tests/test_spec_ergonomics.py +340 -0
- abbot-0.1.0/tests/test_supervision.py +101 -0
- abbot-0.1.0/tests/test_travel.py +222 -0
- abbot-0.1.0/tests/test_ui_builder.py +152 -0
- abbot-0.1.0/tests/test_ui_halt.py +63 -0
- abbot-0.1.0/tests/test_ui_import.py +105 -0
- abbot-0.1.0/tests/test_ui_outstanding.py +53 -0
- abbot-0.1.0/tests/test_ui_responsive.py +55 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Pushing a version tag (v0.1.0, ...) builds and uploads that release. PyPI
|
|
4
|
+
# trusts this workflow directly (trusted publishing), so no API token is stored.
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
tags: ["v*"]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.12"
|
|
18
|
+
- name: Check the tag matches the package version
|
|
19
|
+
run: |
|
|
20
|
+
version=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
|
|
21
|
+
if [ "v$version" != "$GITHUB_REF_NAME" ]; then
|
|
22
|
+
echo "Tag $GITHUB_REF_NAME doesn't match version $version in pyproject.toml"
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
if ! grep -q "^__version__ = \"$version\"" src/abbot/__init__.py; then
|
|
26
|
+
echo "abbot.__version__ doesn't match version $version in pyproject.toml"
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
- run: pip install build twine
|
|
30
|
+
- run: python -m build
|
|
31
|
+
- run: twine check dist/*
|
|
32
|
+
- uses: actions/upload-artifact@v4
|
|
33
|
+
with:
|
|
34
|
+
name: dist
|
|
35
|
+
path: dist/
|
|
36
|
+
|
|
37
|
+
publish:
|
|
38
|
+
needs: build
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
# Add required reviewers to this environment in the repo settings to approve
|
|
41
|
+
# each upload by hand.
|
|
42
|
+
environment:
|
|
43
|
+
name: pypi
|
|
44
|
+
url: https://pypi.org/project/abbot/
|
|
45
|
+
permissions:
|
|
46
|
+
id-token: write # trusted publishing
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/download-artifact@v4
|
|
49
|
+
with:
|
|
50
|
+
name: dist
|
|
51
|
+
path: dist/
|
|
52
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
10
|
+
cancel-in-progress: true
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
lint:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.12"
|
|
20
|
+
- run: pip install "ruff==0.16.10" # pinned so new rules don't fail unrelated PRs
|
|
21
|
+
# Lint only; the codebase isn't ruff-formatted.
|
|
22
|
+
- run: ruff check src/ tests/
|
|
23
|
+
|
|
24
|
+
test:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
strategy:
|
|
27
|
+
fail-fast: false
|
|
28
|
+
matrix:
|
|
29
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
30
|
+
name: tests / Python ${{ matrix.python-version }}
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v4
|
|
33
|
+
- uses: actions/setup-python@v5
|
|
34
|
+
with:
|
|
35
|
+
python-version: ${{ matrix.python-version }}
|
|
36
|
+
cache: pip
|
|
37
|
+
# The CPU wheel: abbot runs on the CPU, and the CUDA wheel is gigabytes.
|
|
38
|
+
- run: pip install torch --index-url https://download.pytorch.org/whl/cpu
|
|
39
|
+
- run: pip install -e '.[ui,dev]'
|
|
40
|
+
- name: Fast tests
|
|
41
|
+
run: pytest -m "not slow" -q
|
|
42
|
+
- name: Slow tests (GP fits, policies, end-to-end loops)
|
|
43
|
+
run: pytest -m slow -q
|
abbot-0.1.0/.gitignore
ADDED
abbot-0.1.0/CITATION.cff
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use abbot, please cite it as below."
|
|
3
|
+
title: "abbot: goal-driven Bayesian experimental design for the lab"
|
|
4
|
+
type: software
|
|
5
|
+
authors:
|
|
6
|
+
- family-names: Gasiorowski
|
|
7
|
+
given-names: Sean
|
|
8
|
+
repository-code: "https://github.com/sgasioro/abbot"
|
|
9
|
+
license: Apache-2.0
|
|
10
|
+
keywords:
|
|
11
|
+
- Bayesian optimization
|
|
12
|
+
- Bayesian algorithm execution
|
|
13
|
+
- experimental design
|
|
14
|
+
- laboratory automation
|
abbot-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
abbot-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: abbot
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Goal-driven Bayesian experimental design for the lab.
|
|
5
|
+
Project-URL: Repository, https://github.com/sgasioro/abbot
|
|
6
|
+
Project-URL: Issues, https://github.com/sgasioro/abbot/issues
|
|
7
|
+
Author: Sean Gasiorowski
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Requires-Dist: botorch>=0.18
|
|
18
|
+
Requires-Dist: gest-api
|
|
19
|
+
Requires-Dist: numpy>=1.26
|
|
20
|
+
Requires-Dist: pydantic>=2
|
|
21
|
+
Requires-Dist: torch>=2.7
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
24
|
+
Requires-Dist: ruff>=0.8; extra == 'dev'
|
|
25
|
+
Provides-Extra: examples
|
|
26
|
+
Requires-Dist: jupyter; extra == 'examples'
|
|
27
|
+
Requires-Dist: matplotlib>=3.9; extra == 'examples'
|
|
28
|
+
Requires-Dist: nbclient>=0.10; extra == 'examples'
|
|
29
|
+
Requires-Dist: nbformat>=5; extra == 'examples'
|
|
30
|
+
Provides-Extra: sbi
|
|
31
|
+
Requires-Dist: pyro-ppl>=1.9; extra == 'sbi'
|
|
32
|
+
Requires-Dist: sbi<0.23,>=0.22; extra == 'sbi'
|
|
33
|
+
Provides-Extra: ui
|
|
34
|
+
Requires-Dist: nicegui>=1.4; extra == 'ui'
|
|
35
|
+
Requires-Dist: plotly>=5; extra == 'ui'
|
|
36
|
+
Provides-Extra: xopt
|
|
37
|
+
Requires-Dist: xopt>=3.2; extra == 'xopt'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# abbot
|
|
41
|
+
|
|
42
|
+
**Goal-driven Bayesian experimental design for the lab.**
|
|
43
|
+
|
|
44
|
+
abbot helps you choose which experiment to run next. You describe the knobs you
|
|
45
|
+
can turn, what you measure, and what you want to achieve; abbot suggests a
|
|
46
|
+
setting, you (or your instrument, or a simulation) run it and report the result,
|
|
47
|
+
and it learns from every run. The goal can be:
|
|
48
|
+
|
|
49
|
+
- **an optimum:** single- or multi-objective Bayesian optimization;
|
|
50
|
+
- **a region:** every setting that hits a target band, a level set, the best point
|
|
51
|
+
per band (Bayesian algorithm execution, BAX);
|
|
52
|
+
- **anything you can write as code** over the model's predictions.
|
|
53
|
+
|
|
54
|
+
The aim is to make sophisticated methods (goal-driven search, multiple fidelities
|
|
55
|
+
or sources, constraints, supervision) available through a short, readable spec
|
|
56
|
+
with safe defaults, so a lab gets them without writing BoTorch code or tuning an
|
|
57
|
+
algorithm.
|
|
58
|
+
|
|
59
|
+
It's built for how lab work goes: a measurement that isn't one number (a
|
|
60
|
+
spectrum, replicates, a posterior from simulation-based inference), runs that
|
|
61
|
+
are slow or fail, and a person who stays in charge of halts, retries and
|
|
62
|
+
overrides. A web UI runs a campaign with no code. Built on [BoTorch](https://botorch.org):
|
|
63
|
+
abbot uses its models and standard acquisition functions, and adds goal-driven
|
|
64
|
+
(BAX) acquisitions and the campaign around them.
|
|
65
|
+
|
|
66
|
+
**Status: alpha.** APIs marked *Stable* in [`docs/API.md`](https://github.com/sgasioro/abbot/blob/main/docs/API.md) are safe to
|
|
67
|
+
build on; *Provisional* ones may change between releases. Issues and pull requests
|
|
68
|
+
are welcome.
|
|
69
|
+
|
|
70
|
+
## Install
|
|
71
|
+
|
|
72
|
+
abbot needs Python 3.11 or later (tested on 3.11–3.13). Install torch first, from
|
|
73
|
+
PyTorch's index (the CPU build is enough; see [Local setup](https://github.com/sgasioro/abbot#local-setup)
|
|
74
|
+
for a GPU):
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install torch --index-url https://download.pytorch.org/whl/cpu
|
|
78
|
+
pip install "abbot[ui]"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The `ui` extra adds the web frontend; `xopt` and `sbi` add those integrations.
|
|
82
|
+
|
|
83
|
+
## Quickstart
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from abbot import ProblemSpec, OutputSpec, ContinuousDomain, Campaign
|
|
87
|
+
|
|
88
|
+
def run_in_lab(temp): # a stand-in: your measurement here
|
|
89
|
+
return 1.0 - ((temp - 55.0) / 30.0) ** 2
|
|
90
|
+
|
|
91
|
+
# 1. Define the problem: design knobs + what you measure.
|
|
92
|
+
spec = ProblemSpec(
|
|
93
|
+
domain=[ContinuousDomain(name="temp", lower=20.0, upper=80.0)],
|
|
94
|
+
outputs=[OutputSpec(name="yield", direction="MAXIMIZE")],
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
# 2. Open a session. The policy, surrogate and a few space-filling starting
|
|
98
|
+
# points are picked from the spec (pass initial_designs= for your own).
|
|
99
|
+
campaign = Campaign(spec)
|
|
100
|
+
|
|
101
|
+
# 3. Ask → run in the lab → tell. Repeat.
|
|
102
|
+
for _ in range(8):
|
|
103
|
+
x = campaign.suggest(1)[0] # e.g. {"temp": 54.2}
|
|
104
|
+
measured_yield = run_in_lab(x["temp"])
|
|
105
|
+
campaign.ingest({"yield": measured_yield})
|
|
106
|
+
|
|
107
|
+
# 4. Hand over the recommended design.
|
|
108
|
+
best = campaign.result().best # a Record; best.candidate is the setting
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
You report **raw physical values** (`direction` handles maximize vs. minimize for
|
|
112
|
+
you — never pre-negate). `Campaign(spec)` picks `SimpleBO` for one objective and
|
|
113
|
+
`ParetoBO` for several, with a GP surrogate; pass `Campaign(spec, policy,
|
|
114
|
+
model_constructor)` to choose your own. A few variations:
|
|
115
|
+
|
|
116
|
+
- **Programmatic experiment** — if measurements come from code (an instrument
|
|
117
|
+
driver, a simulator), hand over the whole loop: `run_campaign(spec, experiment,
|
|
118
|
+
n_shots=8)`, where `experiment` is any object with `run(design) -> outputs`.
|
|
119
|
+
`design` is the same `{"temp": 54.2}` dict `suggest` gives you; return the
|
|
120
|
+
outputs as a `{"yield": ...}` dict (or a list in `spec.outputs` order).
|
|
121
|
+
- **Multi-objective** — give the spec two+ directional outputs; the same calls
|
|
122
|
+
pick `ParetoBO`, and `result().recommended` is the Pareto set.
|
|
123
|
+
- **Find a region, not an optimum (BAX)** — mark outputs `direction="OBSERVE"`, pick
|
|
124
|
+
a `Goal` (e.g. `BandIntersection({"yield": (0.4, 0.6)})`,
|
|
125
|
+
`LevelSet(0.9, output="purity")`), and pass it in: `Campaign(spec,
|
|
126
|
+
BAXPolicy(goal))`.
|
|
127
|
+
- **Keep an output in range** — `OutputSpec(name="purity", direction="OBSERVE",
|
|
128
|
+
min_val=0.9)`: proposals and the recommendation favor designs likely to meet it.
|
|
129
|
+
- **Cheap and accurate runs** — add `sources=[Source(domain=EnumeratedDomain(
|
|
130
|
+
name="code", values=["sim", "experiment"]), target="experiment")]` to the spec:
|
|
131
|
+
abbot chooses which to run, trading cost against information, and recommends
|
|
132
|
+
at the target.
|
|
133
|
+
- **Hold a knob fixed** — `campaign.suggest(1, fixed={"temp": 30})` proposes with
|
|
134
|
+
`temp` at 30 and chooses the rest.
|
|
135
|
+
- **Limit how far a knob moves** — `ContinuousDomain(..., max_step=0.5)`: every
|
|
136
|
+
proposal is within 0.5 of the last one, starting from the `initial_designs` you
|
|
137
|
+
give (the current settings).
|
|
138
|
+
- **Categories** — `EnumeratedDomain(name="solvent", values=["water", "ethanol"])`;
|
|
139
|
+
designs carry the labels, and the model learns how alike they are.
|
|
140
|
+
- **Know when to stop** — `Campaign(spec, supervisor=Supervisor(stops=[
|
|
141
|
+
target_reached(0.95), no_improvement(15)]))` (rules from `abbot.supervision`),
|
|
142
|
+
and `print(campaign.check())` to see whether the model makes sense.
|
|
143
|
+
- **Runs that fail, or regions that give nothing** — a failed run is retried, then
|
|
144
|
+
halts for a person (`campaign.resolve("retry" | "exclude" | "bad_region")`); a
|
|
145
|
+
check like `Supervisor(faults=[per_shot(is_dark, bad_region="dark")])` marks a
|
|
146
|
+
region as unusable, and proposals steer away from it.
|
|
147
|
+
- **No code** — `python -m abbot.ui` launches the lab web frontend over the same
|
|
148
|
+
`Campaign`.
|
|
149
|
+
|
|
150
|
+
See [`docs/HOWTO.md`](https://github.com/sgasioro/abbot/blob/main/docs/HOWTO.md) for "how do I…" answers, [`docs/API.md`](https://github.com/sgasioro/abbot/blob/main/docs/API.md)
|
|
151
|
+
for the stability contract (what's safe to build on), [`examples/`](https://github.com/sgasioro/abbot/tree/main/examples)
|
|
152
|
+
for a runnable notebook per capability, and
|
|
153
|
+
[`docs/ARCHITECTURE.md`](https://github.com/sgasioro/abbot/blob/main/docs/ARCHITECTURE.md) for how abbot is put together
|
|
154
|
+
(modules, the seams an application plugs into, the session API).
|
|
155
|
+
|
|
156
|
+
## Where abbot fits
|
|
157
|
+
|
|
158
|
+
abbot brings together methods that had been spread across several
|
|
159
|
+
problem-specific packages. Labs work in different modes (a control room, a
|
|
160
|
+
beamline, a bench), and good tools already exist for some of them. abbot aims to
|
|
161
|
+
cover the gaps, following the [gest-api](https://pypi.org/project/gest-api/)
|
|
162
|
+
generator standard to promote interoperability and a coherent ecosystem. As it
|
|
163
|
+
develops, the emphasis is on what can be shared with neighboring tools and what
|
|
164
|
+
is better kept separate; [`docs/ECOSYSTEM.md`](https://github.com/sgasioro/abbot/blob/main/docs/ECOSYSTEM.md) has a first pass
|
|
165
|
+
at that split.
|
|
166
|
+
|
|
167
|
+
## Local setup
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Option A — conda:
|
|
171
|
+
conda env create -f environment.yml
|
|
172
|
+
conda activate abbot
|
|
173
|
+
|
|
174
|
+
# Option B — venv (Python 3.11 or later):
|
|
175
|
+
python3.12 -m venv .venv && source .venv/bin/activate
|
|
176
|
+
|
|
177
|
+
# Then, either way: torch first, from PyTorch's index, then abbot.
|
|
178
|
+
pip install torch --index-url https://download.pytorch.org/whl/cpu
|
|
179
|
+
pip install -e '.[ui,dev]' # editable install + UI (nicegui, plotly) + dev (pytest, ruff)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The CPU build of torch is all the UI and the tests need. For an NVIDIA GPU,
|
|
183
|
+
install a CUDA build instead, e.g. `pip install torch --index-url
|
|
184
|
+
https://download.pytorch.org/whl/cu128`; the right tag for your driver is listed
|
|
185
|
+
at [pytorch.org/get-started](https://pytorch.org/get-started). Installing torch
|
|
186
|
+
with pip from PyTorch's index is more reliable than conda's CUDA packages.
|
|
187
|
+
Everything else (BoTorch, `gest-api`, ...) comes from PyPI with `pip install -e`.
|
|
188
|
+
|
|
189
|
+
## Examples
|
|
190
|
+
|
|
191
|
+
Five runnable notebooks in [`examples/`](https://github.com/sgasioro/abbot/tree/main/examples) (install `pip install -e
|
|
192
|
+
'.[examples]'`), one per capability: lab BO, multi-objective (`ParetoBO`),
|
|
193
|
+
composite-SBI, goal-driven BAX, and multi-fidelity. See [`examples/README.md`](https://github.com/sgasioro/abbot/blob/main/examples/README.md).
|
|
194
|
+
|
|
195
|
+
## Run the frontend
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
python -m abbot.ui # http://127.0.0.1:8080, opens a browser tab
|
|
199
|
+
python -m abbot.ui --port 9000 # pick a port (auto-picks a free one if taken)
|
|
200
|
+
python -m abbot.ui --no-show # headless (e.g. on a cluster) — tunnel the port:
|
|
201
|
+
# ssh -L 8080:localhost:8080 <cluster>
|
|
202
|
+
```
|
|
203
|
+
Flags also read env vars: `ABBOT_UI_HOST`, `ABBOT_UI_PORT`, `ABBOT_UI_SHOW`.
|
|
204
|
+
|
|
205
|
+
**Mock mode:** on the Define tab, toggle *Mock mode* before creating the campaign
|
|
206
|
+
to attach a spec-adaptive `MockAnalyticExperiment` (smooth, seeded landscape over
|
|
207
|
+
whatever variables/objectives you defined). This enables **auto-run**
|
|
208
|
+
(run / pause / step / stop) on the Run tab, so a whole campaign drives itself
|
|
209
|
+
with no typed measurements — the quickest way to see the loop and plots working.
|
|
210
|
+
|
|
211
|
+
## Develop
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
pytest -m "not slow" # fast unit tier (no GP fits) — run on every change
|
|
215
|
+
pytest # full suite incl. GP-fitting integration tests (minutes;
|
|
216
|
+
# run before committing)
|
|
217
|
+
ruff check src/ tests/
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Tests are tiered with a `slow` marker: the fast layer uses canned tensors (goal
|
|
221
|
+
logic, reducer scoring, io round-trips, spec/VOCS maps, UI builders); the `slow`
|
|
222
|
+
layer fits GPs / runs policies / drives end-to-end loops (botorch `optimize_acqf`,
|
|
223
|
+
ParetoBO hypervolume, InfoBAX fantasy conditioning, the Xopt run).
|
|
224
|
+
|
|
225
|
+
## Roadmap
|
|
226
|
+
|
|
227
|
+
**Built:**
|
|
228
|
+
- The ask/tell `Campaign`, blocking drivers, resume, batches and asynchronous
|
|
229
|
+
runs with pending designs.
|
|
230
|
+
- Single- and multi-objective BO, uncertainty sampling, and goal-driven BAX
|
|
231
|
+
(InfoBAX, SwitchBAX, MeanBAX) over discrete grids.
|
|
232
|
+
- Composite objectives and SBI (`composite_evaluate`, `Rescore`,
|
|
233
|
+
`abbot.interop.sbi`).
|
|
234
|
+
- Multi-fidelity and multi-source BO with costs (`Source`,
|
|
235
|
+
`MultiSourceGPConstructor`, cost-aware `SimpleBO` and InfoBAX).
|
|
236
|
+
- Output and domain constraints; names, `log=True` inputs and labeled categories
|
|
237
|
+
in the spec; `suggest(fixed=...)`; travel limits (`max_step`).
|
|
238
|
+
- Prior means, and correlated outputs (`default_constructor(spec,
|
|
239
|
+
correlated=True)`).
|
|
240
|
+
- Supervision: fault checks, retries and halts, bad regions with a usability
|
|
241
|
+
classifier, stopping rules, and `campaign.check()` diagnostics.
|
|
242
|
+
- Xopt interop both ways: abbot as an Xopt generator, and Xopt generators (TuRBO,
|
|
243
|
+
Nelder-Mead, ...) in abbot's loop.
|
|
244
|
+
- The NiceGUI lab frontend (`python -m abbot.ui`).
|
|
245
|
+
|
|
246
|
+
**Next:**
|
|
247
|
+
1. **The UI catches up with the engine:** constraints, travel limits, sources,
|
|
248
|
+
`check()`, and a model choice in the builder.
|
|
249
|
+
2. **Agent setup:** an MCP server over `Campaign`, then a setup assistant that
|
|
250
|
+
writes the spec and goal. The UI stays the run console and the
|
|
251
|
+
human-in-the-loop entry point.
|
|
252
|
+
3. **GPU support:** one setting (`Campaign(..., device="cuda")`) that fits models
|
|
253
|
+
and runs policies on the GPU, while the history, saved files, experiments and
|
|
254
|
+
the UI stay on the CPU. The default stays CPU, since lab-scale GPs are usually
|
|
255
|
+
faster there. CUDA only: abbot fits in float64, which Apple's MPS doesn't
|
|
256
|
+
support.
|
|
257
|
+
|
|
258
|
+
**Later:**
|
|
259
|
+
- Continuous BAX (no candidate grid).
|
|
260
|
+
- Correlated outputs together with sources or prior means.
|
|
261
|
+
- A BAX-shaped multi-fidelity goal; noise that varies with the source.
|
|
262
|
+
- Check shots at a known-good design.
|
|
263
|
+
- A Bluesky route: abbot as a blop `Optimizer` backend
|
|
264
|
+
(see [`docs/ECOSYSTEM.md`](https://github.com/sgasioro/abbot/blob/main/docs/ECOSYSTEM.md)).
|
|
265
|
+
- A run-level JSON format that includes cached SBI payloads.
|
|
266
|
+
|
|
267
|
+
**Ease of use is a priority.** For each core workflow we periodically set the
|
|
268
|
+
same problem up in abbot and in neighboring tools, and compare how much a
|
|
269
|
+
newcomer must learn and get right by hand, to find what to improve in abbot.
|
|
270
|
+
|
|
271
|
+
## Citing
|
|
272
|
+
|
|
273
|
+
If abbot helps your work, please cite the repository (see
|
|
274
|
+
[`CITATION.cff`](https://github.com/sgasioro/abbot/blob/main/CITATION.cff)). Its goal-driven policies follow:
|
|
275
|
+
|
|
276
|
+
- W. Neiswanger, K. A. Wang and S. Ermon, "Bayesian Algorithm Execution:
|
|
277
|
+
Estimating Computable Properties of Black-box Functions Using Mutual
|
|
278
|
+
Information," *ICML* 2021, [arXiv:2104.09460](https://arxiv.org/abs/2104.09460)
|
|
279
|
+
(InfoBAX).
|
|
280
|
+
- S. R. Chitturi *et al.*, "Targeted materials discovery using Bayesian
|
|
281
|
+
algorithm execution," *npj Computational Materials* 10, 156 (2024),
|
|
282
|
+
[doi:10.1038/s41524-024-01326-2](https://doi.org/10.1038/s41524-024-01326-2)
|
|
283
|
+
(MeanBAX, SwitchBAX and target-subset goals).
|
|
284
|
+
|
|
285
|
+
and its models and standard acquisitions come from BoTorch: M. Balandat *et al.*,
|
|
286
|
+
"BoTorch: A Framework for Efficient Monte-Carlo Bayesian Optimization,"
|
|
287
|
+
*NeurIPS* 2020, [arXiv:1910.06403](https://arxiv.org/abs/1910.06403).
|
|
288
|
+
|
|
289
|
+
## License
|
|
290
|
+
|
|
291
|
+
Apache-2.0; see [`LICENSE`](https://github.com/sgasioro/abbot/blob/main/LICENSE).
|