-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add basic docs for optimizers and loops (#125)
* add basic docs for optimizers and loops * add badges --------- Signed-off-by: Grossberger Lukas (CR/AIR2.2) <Lukas.Grossberger@de.bosch.com>
- Loading branch information
Showing
14 changed files
with
151 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
__version__ = "5.0.3" | ||
__version__ = "5.0.4" | ||
|
||
from parameterspace import ParameterSpace | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Dask Distributed Optimization Loop | ||
|
||
In case you are working with [dask](https://github.com/dask/dask/), this optimization | ||
loop can help you run `blackboxopt` based optimization leveraging your dask cluster. | ||
See also the corresponding [example](../../examples/dask-distributed) for more | ||
details. | ||
|
||
::: blackboxopt.optimization_loops.dask_distributed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Optimization Loops | ||
|
||
We include a handful optimization loop implementations for different scenarios from a | ||
simple [sequential](sequential.md) loop to one [distributed](dask-distributed.md) | ||
potentially across nodes in a cluster setup. | ||
Additionally, a set of [reference tests](testing.md) are included for | ||
anyone extending the selection of optimization loops as part of a contribution to | ||
`blackboxopt` or in a separate project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Sequential Optimization Loop | ||
|
||
::: blackboxopt.optimization_loops.sequential |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Reference Tests | ||
|
||
To test an optimization loop implementation across various reference scenarios, follow: | ||
|
||
```python | ||
import pytest | ||
from blackboxopt.optimization_loops.testing import ALL_REFERENCE_TESTS | ||
|
||
@pytest.mark.parametrize("reference_test", testing.ALL_REFERENCE_TESTS) | ||
def test_all_reference_tests(reference_test): | ||
reference_test(custom_optimization_loop, {"opt_loop_specific_kwarg": 123}) | ||
``` | ||
|
||
where you can include custom keyword arguments that are passed to the optimization loop | ||
calls in the reference tests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# BOHB Optimizer | ||
|
||
BOHB performs robust and efficient hyperparameter optimization at scale by combining the | ||
speed of Hyperband searches with the guidance and guarantees of convergence of Bayesian | ||
Optimization. | ||
Instead of sampling new configurations at random, BOHB uses kernel density estimators to | ||
select promising candidates. | ||
|
||
This implementation is meant to supersede the initial release of | ||
[HpBandSter](https://github.com/automl/HpBandSter/). | ||
|
||
|
||
## Fidelities | ||
|
||
Here you can calculate the fidelity schedule resulting from BOHB's hyper-parameters: | ||
|
||
<script> | ||
function calculateFidelitiesBOHB() { | ||
const min_fidelity = document.getElementById('minFidelityBOHB').value; | ||
const max_fidelity = document.getElementById('maxFidelityBOHB').value; | ||
const eta = document.getElementById('etaBOHB').value; | ||
|
||
const max_num_stages = 1 + Math.floor( | ||
Math.log(max_fidelity / min_fidelity) / Math.log(eta) | ||
); | ||
const num_configs_first_stage = Math.ceil(Math.pow(eta, max_num_stages - 1)); | ||
const num_configs_per_stage = Array.from({ length: max_num_stages }, (_, i) => | ||
Math.floor(num_configs_first_stage / Math.pow(eta, i)) | ||
); | ||
const fidelities_per_stage = Array.from({ length: max_num_stages }, (_, i) => | ||
max_fidelity / Math.pow(eta, max_num_stages - 1 - i) | ||
); | ||
|
||
document.getElementById('fidelitiesBOHB').innerHTML = `Fidelities: ${fidelities_per_stage}`; | ||
} | ||
</script> | ||
<table> | ||
<tr> | ||
<td>min_fidelity</td> | ||
<td><input type="text" id="minFidelityBOHB"></td> | ||
</tr> | ||
<tr> | ||
<td>max_fidelity</td> | ||
<td><input type="text" id="maxFidelityBOHB"></td> | ||
</tr> | ||
<tr> | ||
<td>eta</td> | ||
<td><input type="text" id="etaBOHB"></td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td><button onclick="calculateFidelitiesBOHB();">Calculate</button></td> | ||
</tr> | ||
</table> | ||
<p id="fidelitiesBOHB"></p> | ||
|
||
|
||
## Reference | ||
|
||
::: blackboxopt.optimizers.bohb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# BoTorch Base Optimizer | ||
|
||
This optimizer is a basic Gaussian Process based Bayesian optimization implementation | ||
leveraging BoTorch in a way that is compatible with the `blackboxopt` interface. | ||
While this is a functional optimizer, it is more intended as a basis for other BoTorch | ||
based optimizer implementations. | ||
|
||
## Reference | ||
|
||
::: blackboxopt.optimizers.botorch_base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Space Filling Optimizer | ||
|
||
The `SpaceFilling` optimizer is a | ||
[Sobol sequence](https://en.wikipedia.org/wiki/Sobol_sequence) based optimizer that | ||
covers the search space based on a quasi-random low-discrepancy sequence. | ||
This strategy requires a larger budget for evaluations but can be a good initial | ||
approach to get to know the optimization problem at hand. | ||
While this implementation follows the overall interface including the specification and | ||
reporting of objectives and their values, the actual objective values are | ||
inconsequential for the underlying Sobol sequence and do not guide the optimization. | ||
|
||
## Reference | ||
|
||
::: blackboxopt.optimizers.space_filling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Reference Tests | ||
|
||
When you develop an optimizer based on the interface defined as part of | ||
`blackboxopt.base`, you can use `blackboxopt.testing` to directly test whether your | ||
implementation follows the specification by adding a test like this to your test suite: | ||
|
||
```python | ||
import pytest | ||
from blackboxopt.testing import ALL_REFERENCE_TESTS | ||
|
||
@pytest.mark.parametrize("reference_test", ALL_REFERENCE_TESTS) | ||
def test_all_reference_tests(reference_test): | ||
reference_test(CustomOptimizer, optional_optimizer_init_kwargs) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters