Distributed Asynchronous Hyperparameter Optimization
Maintained. Last release 4 months ago, commits in 3 of the last 26 weeks. Weaker on commit activity and issue handling.
pip install hyperoptHyperopt: Distributed Hyperparameter Optimization
Hyperopt is a Python library for serial and parallel optimization over awkward search spaces, which may include real-valued, discrete, and conditional dimensions.
Getting started
Install hyperopt from PyPI
pip install hyperopt
# or with uv
uv add hyperopt
Hyperopt supports the following extras:
SparkTrialsMongoTrialsATPE
to run your first example
# define an objective function
def objective(args):
case, val = args
if case == 'case 1':
return val
else:
return val ** 2
# define a search space
from hyperopt import hp
space = hp.choice('a',
[
('case 1', 1 + hp.lognormal('c1', 0, 1)),
('case 2', hp.uniform('c2', -10, 10))
])
# minimize the objective over the space
from hyperopt import fmin, tpe, space_eval
best = fmin(objective, space, algo=tpe.suggest, max_evals=100)
print(best)
# -> {'a': 1, 'c2': 0.01420615366247227}
print(space_eval(space, best))
# -> ('case 2', 0.01420615366247227}
Contributing
If you're a developer and wish to contribute, please follow these steps.
Setup (based on this)
This project uses uv for dependency management. Install it first if you haven’t: