Giter Site home page Giter Site logo

boschresearch / blackboxopt Goto Github PK

View Code? Open in Web Editor NEW
24.0 7.0 1.0 5.81 MB

Blackbox optimization algorithms with a common interface, along with useful helpers like parallel optimization loops, analysis and visualization scripts.

Home Page: https://boschresearch.github.io/blackboxopt/

License: Apache License 2.0

Python 99.29% JavaScript 0.71%
python optimization-algorithms blackbox-optimization bcai

blackboxopt's Introduction

Blackbox Optimization

License CI/CD PyPI - Wheel PyPI - Python Version Code style: black

Various blackbox optimization algorithms with a common interface along with useful helpers like parallel optimization loops, analysis and visualization scripts.

Random search is provided as an example optimizer along with tests for the interface.

New optimizers can require blackboxopt as a dependency, which is just the light-weight interface definition. If you want all optimizer implementations that come with this package, install blackboxopt[all] Alternatively, you can get individual optimizers with e.g. blackboxopt[bohb]

This software is a research prototype. The software is not ready for production use. It has neither been developed nor tested for a specific use case. However, the license conditions of the applicable Open Source licenses allow you to adapt the software to your needs. Before using it in a safety relevant setting, make sure that the software fulfills your requirements and adjust it according to any applicable safety standards (e.g. ISO 26262).

Documentation

Visit boschresearch.github.io/blackboxopt

Development

Install poetry >= 1.5.0

pip install --upgrade poetry

Install the blackboxopt package from source by running the following from the root directory of this repository

poetry install

(Optional) Install pre-commit hooks to check code standards before committing changes:

poetry run pre-commit install

Test

Make sure to install all extras before running tests

poetry install -E testing
poetry run pytest tests/

For HTML test coverage reports run

poetry run pytest tests/ --cov --cov-report html:htmlcov

Building Documentation

Make sure to install all necessary dependencies:

poetry install --extras=all

The documentation can be built from the repository root as follows:

poetry run mkdocs build --clean --no-directory-urls

For serving it locally while working on the documentation run:

poetry run mkdocs serve

Architectural Decision Records

Create evaluation result from specification

In the context of initializing an evaluation result from a specification, facing the concern that having a constructor with a specification argument while the specification attributes end up as toplevel attributes and not summarized under a specification attribute we decided for unpacking the evaluation specification like a dictionary into the result constructor to prevent the said cognitive dissonance, accepting that the unpacking operator can feel unintuitive and that users might tend to matching the attributes explictly to the init arguments.

Report multiple evaluations

In the context of many optimizers just sequentally reporting the individual evaluations when multiple evaluations are reported at once and thus not leveraging any batch reporting benefits, facing the concern that representing that common behaviour in the optimizer base class requires the definition of an abstract report single and an abstract report multi method for which the report single does not need to be implemented if the report multi is, we decided to refactor the arising redundancy into a function call_functions_with_evaluations_and_collect_errors, accepting that this increases the cognitive load when reading the code.

License

blackboxopt is open-sourced under the Apache-2.0 license. See the LICENSE file for details.

For a list of other open source components included in blackboxopt, see the file 3rd-party-licenses.txt.

blackboxopt's People

Contributors

aeivazi avatar dynobo avatar lgro avatar lreeb avatar ptighin avatar sfalkner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

silolytics

blackboxopt's Issues

Enable coverage comparison

With the coverage reporting action we still get the following note:

No coverage data of the default branch was found for comparison. A possible reason for this is that the coverage action has not yet run after a push event and the data is therefore not yet initialized.

Enable storing the coverage in the respective branch to allow the comparison in each PR.

Could it be that the following line points to a non existing step output because the step names changed between the example and our implementation?
https://github.com/boschresearch/blackboxopt/blob/main/.github/workflows/python.yaml#L85

objectives_matrix visualization breaks for non-multi-fidelity plots

The function to generate the hover text currently assumes to have fidelities to display, which must not be the case. Needs to be implemented more robustly.

Failing example evaluations:

evaluation = [
                EvaluationSpecification(
                    evaluation_spec_id="1", run_id="1", configuration={"p1": 1.23}
                ),
                Evaluation(
                    evaluation_spec_id="2",
                    run_id="1",
                    configuration={"p1": 1.4},
                    objectives={"loss": 1.1, "score": 9001},
                ),
                Evaluation(
                    evaluation_spec_id="3",
                    run_id="1",
                    configuration={"p1": 1.3},
                    objectives={"loss": 1.4, "score": 9001},
                ),
            ]

BOHB is using ParameterSpace features

Our linter detected an issue with BOHB's usage of the ParameterSpace:

As the type hints indicate, BOHB requires a SearchSpace for the initialization (L125).

On the other hand, it uses search_space.__iter__() when it iterates over the parameters (L180).

But the base class SearchSpace currently doesn't require an __iter__() implementation. Only the child class does.

We should check how we can solve this. (For the time being, the linter has been set to ignore the issue. But we should enable it again after we solved this)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.