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.
- Host: GitHub
- URL: https://github.com/c-bata/goptuna-bayesopt
- Owner: c-bata
- License: mit
- Archived: true
- Created: 2020-03-10T17:57:01.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-29T22:38:49.000Z (almost 6 years ago)
- Last Synced: 2024-06-20T17:38:47.603Z (almost 2 years ago)
- Topics: bayesian-optimization, gaussian-processes
- Language: Go
- Homepage: https://godoc.org/github.com/c-bata/goptuna-bayesopt
- Size: 13.7 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.