bayesian-optimization
Bayesian Optimization package
What it is and what it does
Bayesian Optimization is a constrained global optimization library that finds the maximum of an unknown function by constructing a posterior distribution (Gaussian process) of candidate functions and iteratively selecting the most promising parameter combinations to evaluate. It is designed for scenarios where evaluating the objective function is computationally expensive or time-consuming—such as hyperparameter tuning for machine learning models, experimental design, or simulation-based optimization.
The package works by fitting a Gaussian Process to previously observed function evaluations, then using an acquisition function (such as Upper Confidence Bound or Expected Improvement) to decide which parameters to try next. This approach reduces the number of function evaluations needed compared to grid search or random search. It supports bounded parameter spaces, random initialization phases to diversify exploration, and access to both the best result found and the full history of all trials.
Use it for:
- Tune hyperparameters of machine learning models when cross-validation is expensive
- Optimize expensive simulations or physical experiments with limited budget for trials
- Find optimal configuration parameters for systems where evaluation is time-consuming
- Explore high-dimensional parameter spaces where grid or random search is infeasible
- Balance exploration vs. exploitation in sequential decision-making problems
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Bayesian optimization using Gaussian processes to find the maximum of an expensive unknown function with minimal iterations, balancing exploration and exploitation automatically.
Yes. The package is actively maintained, has no known vulnerabilities, installs with low friction, and uses permissive MIT licensing. It is well-suited for anyone optimizing expensive functions where reducing the number of evaluations matters. The dependency chain (numpy, scipy, scikit-learn) is standard and stable. Start with it if you need Bayesian optimization; the API is straightforward.
Install
bayesian-optimization on PyPI
pip
pip install bayesian-optimizationuv
uv add bayesian-optimizationpoetry
poetry add bayesian-optimizationInstalling bayesian-optimization
Before you install
Low friction install with pure Python wheels. Actively maintained as of 76 days ago, supports Python 3.9 through 3.14, and depends on well-established scientific libraries (numpy, scipy, scikit-learn).
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for commercial and proprietary projects.
Quickstart
pip install bayesian-optimization
from bayesian_optimization import BayesianOptimization
def black_box_function(x, y):
return -x**2 - (y - 1)**2 + 1
optimizer = BayesianOptimization(
f=black_box_function,
pbounds={'x': (2, 4), 'y': (-3, 3)},
random_state=1,
)
optimizer.maximize(init_points=2, n_iter=3)
print(optimizer.max)
Verify before relying
- Whether the package handles multi-objective optimization or only single-objective maximization
- Performance characteristics on high-dimensional parameter spaces (scalability limits)
- Whether parallel or distributed evaluation of the objective function is supported
Package facts
| License | The MIT License (MIT) Copyright (c) 2014 Fernando M. F. Nogueira Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — colorama, numpy, packaging, scikit-learn, scipy |
| Maintenance | actively maintained — 76 days since the last release |
| First released | |
| Downloads | 789,659/month — #5,053 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: bayesian_optimization-3.3.0-py3-none-any.whl
Tags
More Mathematics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
kiwisolverkiwisolver is a Python binding to a fast C++…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
botorchBoTorch provides a modular, PyTorch-based…
permissive · top 5,000 on PyPI
scikit-optimizeScikit-Optimize is a library for optimizing…
permissive · top 15,000 on PyPI
hyperoptHyperopt performs serial and parallel…
permissive · top 5,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
ConfigSpaceConfigSpace defines and manipulates…
permissive · top 15,000 on PyPI
lmfitLmfit provides non-linear least-squares…
permissive · top 5,000 on PyPI
pymcPyMC is a Python package for Bayesian…
permissive · top 5,000 on PyPI
k-means-constrainedK-means clustering with enforced minimum and…
permissive · top 15,000 on PyPI
cmaCMA-ES is a derivative-free numerical…
permissive · top 5,000 on PyPI