humpday
A unified interface to fifty-plus derivative-free Python optimizers — plus Elo ratings so you can pick the right one.
Choosing a Python global optimizer means picking from a dozen packages, each with its own quirky calling convention. humpday wraps fifty-plus optimization strategies from Ax-Platform, BayesianOptimization, DLib, HyperOpt, NeverGrad, Optuna, Platypus, PyMoo, PySOT, SciPy, Skopt, NLopt, BOBYQA, UltraOpt, FreeLunch and friends in a single calling syntax — and assigns each an Elo rating from head-to-head tournaments parameterised by problem dimension and function-eval budget. Pass your problem; get a defensible recommendation back.
Install
pip install humpday
pip install humpday[full] # bring in every optional backend
Recommend an optimizer for your problem
Pass the dimension, an evaluation budget, and a time budget. suggest() returns
a ranked list of strategies that should perform well for that profile, independent of any
specific objective function:
from pprint import pprint
from humpday import suggest
pprint(suggest(n_dim=5, n_trials=130, n_seconds=5*60))
# n_seconds is the *total* wall-clock budget the optimizer has,
# not per-evaluation. Set this near your real constraint.
Or pass the objective itself and let humpday time it for you:
import math, time
from humpday import recommend
def my_objective(u):
time.sleep(0.01)
return u[0] * math.sin(u[1])
recommendations = recommend(my_objective, n_dim=21, n_trials=130)
Run a points race on your own benchmark
Got a list of objective functions you actually care about? Run a tournament locally and get rankings specific to your domain:
from humpday import points_race
points_race(objectives=[my_objective] * 2, n_dim=5, n_trials=100)
Walkthrough in the Colab notebook.
Optimize on a simplex
Several humpday transforms map the unit cube to the unit simplex (and back), so any
cube-based optimizer can be applied to simplex-constrained problems — portfolio
weights, mixture components, probability vectors. See
cubetosimplex.py for the variants.
Packages wrapped
How the Elo ratings work
The sister repo
optimizer-elo-ratings
runs ongoing head-to-head tournaments between every wrapped strategy across a battery of
synthetic objectives. Each match awards Elo points the same way chess does, parameterised
by problem dimension and trial budget. The
leaderboard is the live ranking; suggest() looks up the top strategies
for your specific $(d, n_{\text{trials}})$ corner of that grid.
Articles
- HumpDay: A Package to Take the Pain Out of Choosing a Python Optimizer
- Comparing Python Global Optimizers
- Interpreting the Elo Ratings for Python Global Optimizers
Cite or be cited
Pull requests at
CITE.md
are welcome — if your package is benchmarked here we want to credit you correctly.
Contribute
Adding a new optimizer is small: implement the common-syntax wrapper in
humpday/optimizers/, register it, and the Elo machinery will pick it up
on the next tournament.