An open API service indexing awesome lists of open source software.

https://github.com/c-bata/goptuna-bayesopt

Goptuna sampler for Gaussian Process based bayesian optimization using d4l3k/go-bayesopt.
https://github.com/c-bata/goptuna-bayesopt

bayesian-optimization gaussian-processes

Last synced: 5 months ago
JSON representation

Goptuna sampler for Gaussian Process based bayesian optimization using d4l3k/go-bayesopt.

Awesome Lists containing this project

README

          

# goptuna-bayesopt

[Goptuna](https://github.com/c-bata/goptuna) sampler for Gaussian Process based bayesian optimization using [d4l3k/go-bayesopt](https://github.com/d4l3k/go-bayesopt/).
This integration supports `SuggestUniform` API only.

```go
package main

import (
"log"
"math"

"github.com/c-bata/goptuna"
bayesopt "github.com/c-bata/goptuna-bayesopt"
)

func objective(trial goptuna.Trial) (float64, error) {
x1, _ := trial.SuggestUniform("x1", -10, 10)
x2, _ := trial.SuggestUniform("x2", -10, 10)
return math.Pow(x1-2, 2) + math.Pow(x2+5, 2), nil
}

func main() {
relativeSampler := bayesopt.NewSampler()
study, err := goptuna.CreateStudy(
"goptuna-example",
goptuna.StudyOptionRelativeSampler(relativeSampler),
)
if err != nil {
log.Fatal("failed to create study:", err)
}

if err = study.Optimize(objective, 50); err != nil {
log.Fatal("failed to optimize:", err)
}

v, _ := study.GetBestValue()
params, _ := study.GetBestParams()
log.Printf("Best evaluation=%f (x1=%f, x2=%f)",
v, params["x1"].(float64), params["x2"].(float64))
}
```

## License

This software is licensed under the MIT license, see [LICENSE](./LICENSE) for more information.