back to home

bayesian-optimization / BayesianOptimization

A Python implementation of global optimization with gaussian processes.

8,572 stars
1,597 forks
8 issues
PythonBatchfileMakefile

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing bayesian-optimization/BayesianOptimization in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/bayesian-optimization/BayesianOptimization)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

Bayesian Optimization Pure Python implementation of bayesian global optimization with gaussian processes. This is a constrained global optimization package built upon bayesian inference and gaussian processes, that attempts to find the maximum value of an unknown function in as few iterations as possible. This technique is particularly suited for optimization of high cost functions and situations where the balance between exploration and exploitation is important. Installation • pip (via PyPI): • Conda (via conda-forge): How does it work? See the documentation for how to use this package. Bayesian optimization works by constructing a posterior distribution of functions (gaussian process) that best describes the function you want to optimize. As the number of observations grows, the posterior distribution improves, and the algorithm becomes more certain of which regions in parameter space are worth exploring and which are not, as seen in the picture below. As you iterate over and over, the algorithm balances its needs of exploration and exploitation taking into account what it knows about the target function. At each step a Gaussian Process is fitted to the known samples (points previously explored), and the posterior distribution, combined with a exploration strategy (such as UCB (Upper Confidence Bound), or EI (Expected Improvement)), are used to determine the next point that should be explored (see the gif below). This process is designed to minimize the number of steps required to find a combination of parameters that are close to the optimal combination. To do so, this method uses a proxy optimization problem (finding the maximum of the acquisition function) that, albeit still a hard problem, is cheaper (in the computational sense) and common tools can be employed. Therefore Bayesian Optimization is most adequate for situations where sampling the function to be optimized is a very expensive endeavor. See the references for a proper discussion of this method. This project is under active development. If you run into trouble, find a bug or notice anything that needs correction, please let us know by filing an issue. Basic tour of the Bayesian Optimization package • Specifying the function to be optimized This is a function optimization package, therefore the first and most important ingredient is, of course, the function to be optimized. **DISCLAIMER:** We know exactly how the output of the function below depends on its parameter. Obviously this is just an example, and you shouldn't expect to know it in a real scenario. However, it should be clear that you don't need to. All you need in order to use this package (and more generally, this technique) is a function that takes a known set of parameters and outputs a real number. • Getting Started All we need to get started is to instantiate a object specifying a function to be optimized , and its parameters with their corresponding bounds, . This is a constrained optimization technique, so you must specify the minimum and maximum values that can be probed for each parameter in order for it to work The BayesianOptimization object will work out of the box without much tuning needed. The main method you should be aware of is , which does exactly what you think it does. There are many parameters you can pass to maximize, nonetheless, the most important ones are: • : How many steps of bayesian optimization you want to perform. The more steps the more likely to find a good maximum you are. • : How many steps of **random** exploration you want to perform. Random exploration can help by diversifying the exploration space. | iter | target | x | y | ------------------------------------------------- | 1 | -7.135 | 2.834 | 1.322 | | 2 | -7.78 | 2.0 | -1.186 | | 3 | -19.0 | 4.0 | 3.0 | | 4 | -16.3 | 2.378 | -2.413 | | 5 | -4.441 | 2.105 | -0.005822 | ================================================= The best combination of parameters and target value found can be accessed via the property . While the list of all parameters probed and their corresponding target values is available via the property . Minutiae Citation If you used this package in your research, please cite it: If you used any of the advanced functionalities, please additionally cite the corresponding publication: For the : For constrained optimization: For optimization over non-float parameters: