Warning
This package is a work in progress. Some solvers have not been properly tested. For an authoritative list of the stable solvers, check below or our documentation.
poli-baselines
is a collection of black box optimization algorithms, aimed mostly at optimizing discrete sequences. These optimization algorithms are meant to optimize objective functions defined using poli
, a tool for instantiating complex, difficult-to-query functions.
If the dependencies get too specific, we provide replicable conda environments for each solver.
Create a fresh conda environment by running
conda create -n poli-baselines python=3.10
conda activate poli-baselines
After which, you can install this package by running
pip install "poli-baselines @ git+https://github.com/MachineLearningLifeScience/poli-baselines.git@main"
After this, you could test you installation by running (inside your poli-baselines
environment):
python -c "import poli_baselines ; print('Everything went well!')"
Some solvers run on specific conda environments. We provide
the environment.yml
files for each, so you can replicate
the environment in your computer.
These can be found in the folder of each solver.
Name | Status | Reference |
---|---|---|
Random Mutations | N/A | |
Random hill-climbing | N/A | |
CMA-ES | pycma | |
(Fixed-length) Genetic Algorithm | pymoo's implementation | |
Hvarfner's Vanilla BO | Hvarfner et al. 2024 | |
Bounce | Papenmeier et al. 2023 | |
BAxUS | Papenmeier et al. 2022 | |
Probabilistic Reparametrization | Daulton et al. 2022 | |
SAASBO | Eriksson and Jankowiak 2021 | |
ALEBO | Lentham et al. 2020 | |
LaMBO2 | Gruver and Stanton et al. 2020 |
As mentioned above, this library interoperates well with the discrete objective functions defined in poli
. One such objective function is the ALOHA problem, in which we search the space of 5-letter sequences of the word "ALOHA". The following is a simple example of how one could use the RandomMutation
solver inside poli-baselines
to solve this problem:
from poli.objective_repository import AlohaProblemFactory
from poli_baselines.solvers import RandomMutation
# Creating an instance of the problem
problem = AlohaProblemFactory().create()
f, x0 = problem.black_box, problem.x0
y0 = f(x0)
# Creating an instance of the solver
solver = RandomMutation(
black_box=f,
x0=x0,
y0=y0,
)
# Running the optimization for 1000 steps,
# breaking if we find a performance above 5.0.
solver.solve(max_iter=1000, break_at_performance=5.0)
# Checking if we got the solution we were waiting for
print(solver.get_best_solution()) # Should be [["A", "L", "O", "H", "A"]]
The examples
folder includes the optimization of more complex objective functions such as foldx
stability (if you have foldx
installed in your computer), and the use of advanced black box optimizers like (Line) Bayesian Optimization.
We have an ongoing benchmark! We are using poli
and poli-baselines
to test several high-dimensional Bayesian optimization methods.
If you want to contribute a new solver for the benchmark, follow these instructions. We expect new optimizers to be contributed as pull requests to this project.
Take a look at our open issues, and check our guide to contributing.