Skip to content

# d4l3k/go-bayesopt

A library for doing Bayesian Optimization using Gaussian Processes (blackbox optimizer) in Go/Golang.
Go
d4l3k Merge pull request #9 from c-bata/use-go-modules
`Use go modules + fix build`
Latest commit 65bb2b1 Jul 22, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
gp Jul 22, 2019
.gitignore Sep 18, 2017
.travis.yml Jul 6, 2018
LICENSE Sep 18, 2017
README.md Jul 9, 2018
bayesopt.go Aug 23, 2018
bayesopt_test.go Jul 6, 2018
bounds.go Jul 22, 2019
exploration.go Jun 6, 2018
go.mod Jul 22, 2019
go.sum Jul 22, 2019
params.go Aug 23, 2018
params_test.go Aug 23, 2018

# go-bayesopt

A library for doing Bayesian Optimization using Gaussian Processes (blackbox optimizer) in Go/Golang.

This project is under active development, if you find a bug, or anything that needs correction, please let me know.

## Simple Example

```package main

import (
"log"
"math"

"github.com/d4l3k/go-bayesopt"
)

func main() {
X := bayesopt.UniformParam{
Max: 10,
Min: -10,
}
o := bayesopt.New(
[]Param{
X,
},
)
// minimize x^2+1
x, y, err := o.Optimize(func(params map[Param]float64) float64 {
return math.Pow(params[X], 2) + 1
})
if err != nil {
log.Fatal(err)
}
log.Println(x, y)
}```

## How does it work?

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.

## License

go-bayesopt is licensed under the MIT license.

You can’t perform that action at this time.