No project description provided
Project description
BoFire is a Bayesian Optimization Framework Intended for Real Experiments.
Why BoFire?
BoFire ...
- supports mixed continuous, discrete and categorical parameter spaces for system inputs and outputs,
- separates objectives (minimize, maximize, close-to-target) from the outputs on which they operate,
- supports different specific and generic constraints as well as black-box output constraints,
- can provide flexible DoEs that fulfill constraints,
- provides sampling methods for constrained mixed variable spaces,
- serializes problems for use in RESTful APIs and json/bson DBs,
- allows easy out of the box usage of strategies for single and multi-objective Bayesian optimization, and
- provides a high flexibility on the modelling side if needed.
Installation
In our docs, you can find all different options for the BoFire installation. To install all BoFire-features you need to run
pip install bofire[optimization,cheminfo]
This will also install BoTorch that depends on PyTorch. To use the DoE package, you need to install Cyipopt additionally, e.g., via
conda install -c conda-forge cyipopt
Getting Started
For a more complete introduction to BoFire, please look at the Getting Started documentation.
We first must define the domain of the optimization problem.
from bofire.data_models.features.api import ContinuousInput, ContinuousOutput
from bofire.data_models.objectives.api import MaximizeObjective
from bofire.data_models.constraints.api import NChooseKConstraint
from bofire.data_models.domain.api import Domain, Inputs, Outputs, Constraints
input_features = Inputs(features=[
ContinuousInput(key="x1", bounds=(0,1)),
ContinuousInput(key="x2", bounds=(0,1)),
ContinuousInput(key="x3", bounds=(0,1)),
])
output_features = Outputs(features=[
ContinuousOutput(key="y", objective=MaximizeObjective())
])
constraints = Constraints(constraints=[
NChooseKConstraint(
features=["x1", "x2", "x3"],
min_count=1, max_count=2, none_also_valid=False)
])
domain = Domain(
inputs=input_features,
outputs=output_features,
constraints=constraints
)
You can also use one of the many benchmarks available in BoFire. Here, we use the Himmelblau benchmark to demonstrate the ask/tell interface for proposing new experiments.
from bofire.benchmarks.single import Himmelblau
benchmark = Himmelblau()
samples = benchmark.domain.inputs.sample(10)
experiments = benchmark.f(samples, return_complete=True)
from bofire.data_models.strategies.api import SoboStrategy
from bofire.data_models.acquisition_functions.api import qNEI
import bofire.strategies.api as strategies
sobo_strategy_data_model = SoboStrategy(domain=benchmark.domain, acquisition_function=qNEI())
sobo_strategy = strategies.map(sobo_strategy_data_model)
sobo_strategy.tell(experiments=experiments)
sobo_strategy.ask(candidate_count=1)
This gives one step in the optimization loop. We can repeat this many times to perform Bayesian optimization, exploring the space using intelligent strategies.
Documentation
Documentation including a section on how to get started can be found under https://experimental-design.github.io/bofire/.
Contributing
See our Contributing guidelines. If you are not sure about something or find bugs, feel free to create an issue.
By contributing you agree that your contributions will be licensed under the same license as BoFire: BSD 3-Clause License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bofire-0.0.13.tar.gz
.
File metadata
- Download URL: bofire-0.0.13.tar.gz
- Upload date:
- Size: 3.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1d83e781c63992c1fc9157587189251b4c06f6c9196f0e000e1cd329ca0fe6a |
|
MD5 | f183babea61024b4f6bbd5f6a09ea5fe |
|
BLAKE2b-256 | 35607c909ba7f4b2b2d2f37ab697048290eac5e731f3aeff8946f6ed025d81af |
File details
Details for the file bofire-0.0.13-py3-none-any.whl
.
File metadata
- Download URL: bofire-0.0.13-py3-none-any.whl
- Upload date:
- Size: 430.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1b47732e70770a591d74bb24cdcd1ad1048b60e624df52a1529c6c54f8822c8 |
|
MD5 | 0dbcedf0a02a39b48b60f19030c97408 |
|
BLAKE2b-256 | d8a7a97be30d94856f9d93dec13269e83eefe1d44406668a8ba9b8950b37663f |