You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Versioned docs (#8)
* versioned [email protected]
* Don't trigger publish if target is empty
* Set workflow to trigger on release
* Fix: versions.json path
* Fix edit URI, set site URL to base
* Revert erroneous change, rename format/lint job
* Fix numpy docstrings
* Update README: add docs shield, remove tutorial, references, quick start
* Update README.md
* Make docs a bit more nice: add links to classes imported from elsewhere, updated docstrings
* Rerun `visualization.ipynb` to include `ScreenLogger` colour fixes
This is a constrained global optimization package built upon bayesian inference
29
-
and gaussian process, that attempts to find the maximum value of an unknown
30
-
function in as few iterations as possible. This technique is particularly
31
-
suited for optimization of high cost functions, situations where the balance
32
-
between exploration and exploitation is important.
33
-
34
-
## Quick Start
35
-
See below for a quick tour over the basics of the Bayesian Optimization package. More detailed information, other advanced features, and tips on usage/implementation can be found in the [examples](http://bayesian-optimization.github.io/BayesianOptimization/examples.html) folder. I suggest that you:
36
-
- Follow the [basic tour notebook](http://bayesian-optimization.github.io/BayesianOptimization/basic-tour.html) to learn how to use the package's most important features.
37
-
- Take a look at the [advanced tour notebook](http://bayesian-optimization.github.io/BayesianOptimization/advanced-tour.html) to learn how to make the package more flexible, how to deal with categorical parameters, how to use observers, and more.
38
-
- Check out this [notebook](http://bayesian-optimization.github.io/BayesianOptimization/visualization.html) with a step by step visualization of how this method works.
39
-
- To understand how to use bayesian optimization when additional constraints are present, see the [constrained optimization notebook](http://bayesian-optimization.github.io/BayesianOptimization/constraints.html).
40
-
- Explore this [notebook](http://bayesian-optimization.github.io/BayesianOptimization/exploitation_vs_exploration.html)
41
-
exemplifying the balance between exploration and exploitation and how to
42
-
control it.
43
-
- Go over this [script](https://github.com/bayesian-optimization/BayesianOptimization/blob/master/examples/sklearn_example.py)
44
-
for examples of how to tune parameters of Machine Learning models using cross validation and bayesian optimization.
45
-
- Explore the [domain reduction notebook](http://bayesian-optimization.github.io/BayesianOptimization/domain_reduction.html) to learn more about how search can be sped up by dynamically changing parameters' bounds.
46
-
- Finally, take a look at this [script](https://github.com/bayesian-optimization/BayesianOptimization/blob/master/examples/async_optimization.py)
47
-
for ideas on how to implement bayesian optimization in a distributed fashion using this package.
48
-
49
-
50
38
## How does it work?
51
39
40
+
See the [documentation](https://bayesian-optimization.github.io/BayesianOptimization/) for how to use this package.
41
+
52
42
Bayesian optimization works by constructing a posterior distribution of functions (gaussian process) that best describes the function you want to optimize. As the number of observations grows, the posterior distribution improves, and the algorithm becomes more certain of which regions in parameter space are worth exploring and which are not, as seen in the picture below.
53
43
54
44

@@ -59,8 +49,8 @@ As you iterate over and over, the algorithm balances its needs of exploration an
59
49
60
50
This process is designed to minimize the number of steps required to find a combination of parameters that are close to the optimal combination. To do so, this method uses a proxy optimization problem (finding the maximum of the acquisition function) that, albeit still a hard problem, is cheaper (in the computational sense) and common tools can be employed. Therefore Bayesian Optimization is most adequate for situations where sampling the function to be optimized is a very expensive endeavor. See the references for a proper discussion of this method.
61
51
62
-
This project is under active development, if you find a bug, or anything that
63
-
needs correction, please let me know.
52
+
This project is under active development. If you run into trouble, find a bug or notice
53
+
anything that needs correction, please let us know by filing an issue.
64
54
65
55
66
56
## Basic tour of the Bayesian Optimization package
@@ -154,125 +144,6 @@ for i, res in enumerate(optimizer.res):
154
144
```
155
145
156
146
157
-
#### 2.1 Changing bounds
158
-
159
-
During the optimization process you may realize the bounds chosen for some parameters are not adequate. For these situations you can invoke the method `set_bounds` to alter them. You can pass any combination of **existing** parameters and their associated new bounds.
160
-
161
-
162
-
```python
163
-
optimizer.set_bounds(new_bounds={"x": (-2, 3)})
164
-
165
-
optimizer.maximize(
166
-
init_points=0,
167
-
n_iter=5,
168
-
)
169
-
```
170
-
171
-
| iter | target | x | y |
172
-
-------------------------------------------------
173
-
| 6 | -5.145 | 2.115 | -0.2924 |
174
-
| 7 | -5.379 | 2.337 | 0.04124 |
175
-
| 8 | -3.581 | 1.874 | -0.03428 |
176
-
| 9 | -2.624 | 1.702 | 0.1472 |
177
-
| 10 | -1.762 | 1.442 | 0.1735 |
178
-
=================================================
179
-
180
-
#### 2.2 Sequential Domain Reduction
181
-
182
-
Sometimes the initial boundaries specified for a problem are too wide, and adding points to improve the response surface in regions of the solution domain is extraneous. Other times the cost function is very expensive to compute, and minimizing the number of calls is extremely beneficial.
183
-
184
-
When it's worthwhile to converge on an optimal point quickly rather than try to find the optimal point, contracting the domain around the current optimal value as the search progresses can speed up the search progress considerably. Using the `SequentialDomainReductionTransformer` the bounds of the problem can be panned and zoomed dynamically in an attempt to improve convergence.
An example of using the `SequentialDomainReductionTransformer` is shown in the [domain reduction notebook](http://bayesian-optimization.github.io/BayesianOptimization/domain_reduction.html). More information about this method can be found in the paper ["On the robustness of a simple domain reduction scheme for simulation‐based optimization"](http://www.truegrid.com/srsm_revised.pdf).
189
-
190
-
### 3. Guiding the optimization
191
-
192
-
It is often the case that we have an idea of regions of the parameter space where the maximum of our function might lie. For these situations the `BayesianOptimization` object allows the user to specify points to be probed. By default these will be explored lazily (`lazy=True`), meaning these points will be evaluated only the next time you call `maximize`. This probing process happens before the gaussian process takes over.
193
-
194
-
Parameters can be passed as dictionaries or as an iterable.
195
-
196
-
```python
197
-
optimizer.probe(
198
-
params={"x": 0.5, "y": 0.7},
199
-
lazy=True,
200
-
)
201
-
202
-
optimizer.probe(
203
-
params=[-0.3, 0.1],
204
-
lazy=True,
205
-
)
206
-
207
-
# Will probe only the two points specified above
208
-
optimizer.maximize(init_points=0, n_iter=0)
209
-
```
210
-
211
-
| iter | target | x | y |
212
-
-------------------------------------------------
213
-
| 11 | 0.66 | 0.5 | 0.7 |
214
-
| 12 | 0.1 | -0.3 | 0.1 |
215
-
=================================================
216
-
217
-
218
-
### 4. Saving, loading and restarting
219
-
220
-
By default you can follow the progress of your optimization by setting `verbose>0` when instantiating the `BayesianOptimization` object. If you need more control over logging/alerting you will need to use an observer. For more information about observers checkout the advanced tour notebook. Here we will only see how to use the native `JSONLogger` object to save to and load progress from files.
221
-
222
-
#### 4.1 Saving progress
223
-
224
-
225
-
```python
226
-
from bayes_opt.logger import JSONLogger
227
-
from bayes_opt.event import Events
228
-
```
229
-
230
-
The observer paradigm works by:
231
-
1. Instantiating an observer object.
232
-
2. Tying the observer object to a particular event fired by an optimizer.
233
-
234
-
The `BayesianOptimization` object fires a number of internal events during optimization, in particular, everytime it probes the function and obtains a new parameter-target combination it will fire an `Events.OPTIMIZATION_STEP` event, which our logger will listen to.
235
-
236
-
**Caveat:** The logger will not look back at previously probed points.
By default the previous data in the json file is removed. If you want to keep working with the same logger, the `reset` parameter in `JSONLogger` should be set to False.
251
-
252
-
#### 4.2 Loading progress
253
-
254
-
Naturally, if you stored progress you will be able to load that onto a new instance of `BayesianOptimization`. The easiest way to do it is by invoking the `load_logs` function, from the `util` submodule.
255
-
256
-
257
-
```python
258
-
from bayes_opt.util import load_logs
259
-
260
-
261
-
new_optimizer = BayesianOptimization(
262
-
f=black_box_function,
263
-
pbounds={"x": (-2, 2), "y": (-2, 2)},
264
-
verbose=2,
265
-
random_state=7,
266
-
)
267
-
268
-
# New optimizer is loaded with previously seen points
269
-
load_logs(new_optimizer, logs=["./logs.log"]);
270
-
```
271
-
272
-
## Next Steps
273
-
274
-
This introduction covered the most basic functionality of the package. Checkout the [basic-tour](http://bayesian-optimization.github.io/BayesianOptimization/basic-tour.html) and [advanced-tour](http://bayesian-optimization.github.io/BayesianOptimization/advanced-tour.html), where you will find detailed explanations and other more advanced functionality. Also, browse the [examples](http://bayesian-optimization.github.io/BayesianOptimization/examples.html) for implementation tips and ideas.
275
-
276
147
## Minutiae
277
148
278
149
### Citation
@@ -314,10 +185,3 @@ For constrained optimization:
0 commit comments