skillfed

hyperopt

Distributed Asynchronous Hyperparameter Optimization

hyperopt v0.3.0 2.9M downloads/30d#2,860 on PyPI7,598
Permissive license BSD-3-Clause Active released

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 hyperopt

uv

uv add hyperopt

poetry

poetry add hyperopt

Installing 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

Development Status :: 3 - AlphaEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Science/ResearchOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/EngineeringTopic :: Software Development

Tags

hyperparameter optimizationbayesian optimization libraryparallel hyperparameter tuningTPE algorithm implementationmodel selection searchdistributed optimization pythonhyperparameter search space
bayesian-optimizationhyperparameter-tuningdistributed-computing

More Software Development packages