hyperopt
Distributed Asynchronous Hyperparameter Optimization
What it is and what it does
Hyperopt is a Python library for optimizing over complex, mixed-type search spaces—those containing real-valued, discrete, and conditional parameters. It implements three algorithms: Random Search, Tree of Parzen Estimators (TPE), and Adaptive TPE. The library is designed for both serial optimization on a single machine and parallel optimization across multiple workers using Apache Spark or MongoDB as backends.
You define an objective function to minimize, specify a search space using hyperopt's domain language (hp.choice, hp.uniform, hp.lognormal, etc.), and call fmin() with your chosen algorithm. Hyperopt then explores the space, returning the best parameters found. It's commonly used for tuning machine learning model hyperparameters, though it applies to any optimization problem over awkward search spaces.
Use it for:
- Tune scikit-learn or neural network hyperparameters (learning rate, regularization, layer sizes) to minimize validation loss
- Optimize conditional configurations where some parameters only apply under certain choices (e.g., different solvers with different hyperparameters)
- Parallelize hyperparameter search across a Spark cluster or MongoDB-backed worker pool for large-scale experiments
- Benchmark different algorithms (Random Search vs. TPE) on the same search space to understand their relative efficiency
- Explore high-dimensional spaces where grid search or random search becomes prohibitively expensive
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Hyperopt performs serial and parallel hyperparameter optimization over mixed search spaces using algorithms like Tree of Parzen Estimators (TPE), Random Search, and Adaptive TPE.
Yes. Hyperopt is actively maintained, has no known vulnerabilities, installs with low friction, and is well-suited for anyone doing hyperparameter optimization beyond simple grid or random search. The TPE algorithm is more sample-efficient than random search for most problems. The BSD-3-Clause license poses no restrictions. Start here if you need Bayesian optimization without the overhead of setting up a full Gaussian process library.
Install
hyperopt on PyPI
pip
pip install hyperoptuv
uv add hyperoptpoetry
poetry add hyperoptInstalling hyperopt
Before you install
Low friction install with a pure-Python wheel. Actively maintained with a release 21 days ago and a recent commit on 2026-08-10. Six runtime dependencies (cloudpickle, importlib-resources, networkx, numpy, scipy, tqdm) are all stable, widely-used libraries.
License in practice
BSD-3-Clause is permissive; you can use, modify, and distribute hyperopt freely in commercial and open-source projects provided you include the license notice.
Quickstart
pip install hyperopt
from hyperopt import hp, fmin, tpe, space_eval
def objective(args):
case, val = args
return val if case == 'case 1' else val ** 2
space = hp.choice('a', [('case 1', 1 + hp.lognormal('c1', 0, 1)), ('case 2', hp.uniform('c2', -10, 10))])
best = fmin(objective, space, algo=tpe.suggest, max_evals=100)
print(space_eval(space, best))
Verify before relying
- Whether optional extras (SparkTrials, MongoTrials, ATPE) require additional system dependencies beyond what pip installs
- Performance characteristics and scalability limits for very large search spaces or high-dimensional problems
- How well the package handles edge cases like conditional dimensions with many branches
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — cloudpickle, importlib-resources, networkx, numpy, scipy, tqdm |
| Maintenance | actively maintained — 21 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,851,699/month — #2,860 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: hyperopt-0.3.0-py3-none-any.whl
Keywords: Bayesian optimization, hyperparameter, model selection
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
optunaOptuna is a hyperparameter optimization…
permissive · top 5,000 on PyPI
bayesian-optimizationBayesian optimization using Gaussian processes…
permissive · top 15,000 on PyPI
ConfigSpaceConfigSpace defines and manipulates…
permissive · top 15,000 on PyPI
ax-platformAx is a platform for adaptive experimentation…
permissive · top 15,000 on PyPI
keras-tunerKerasTuner automates hyperparameter…
permissive · top 15,000 on PyPI
scikit-optimizeScikit-Optimize is a library for optimizing…
permissive · top 15,000 on PyPI
botorchBoTorch provides a modular, PyTorch-based…
permissive · top 5,000 on PyPI
pyannote-pipelineDefines and optimizes tunable hyperparameter…
unclear · top 5,000 on PyPI
hydra-optuna-sweeperIntegrates Optuna hyperparameter optimization…
permissive · top 15,000 on PyPI
sweepsGenerates hyperparameter sweep suggestions…
permissive · top 15,000 on PyPI