SlideShare une entreprise Scribd logo
1  sur  57
Télécharger pour lire hors ligne
Go Conference 2019 Autumn
c-bata c_bata_
Distributed Bayesian Optimization Framework
Goptuna
CyberAgent AI Lab
Masashi SHIBATA
c-bata c_bata_
Python
go-prompt, kube-prompt
https://github.com/c-bata
1
2
3
y = f(x)x y
y x
my.cnf
nginx.conf


y
x
2
innodb_buffer_pool_size
80%
FFM 0.02
0.00001
15
Grid Search / Random Search
[Eric et al., 2010]
[Eric et al., 2010]
• : 

• : 

• :


( )
[Eric et al., 2010]




( )
[Eric et al., 2010]




( )
[Eric et al., 2010]
L-BFGS
[Eric et al., 2010]
[Eric et al., 2010]
package main
import (
"log"
"math"
bayesopt "github.com/d4l3k/go-bayesopt"
)
var (
px1 = bayesopt.UniformParam{Name: "X1", Max: 10, Min: -10}
px2 = bayesopt.UniformParam{Name: "X2", Max: 10, Min: -10}
searchSpace = []bayesopt.Param{px1, px2}
)
func objective(params map[bayesopt.Param]float64) float64 {
x1 := params[px1]
x2 := params[px2]
return math.Pow(x1-1, 2) + math.Pow(x2-2, 2)
}
func main() {
o := bayesopt.New(
searchSpace,
bayesopt.WithRandomRounds(10),
bayesopt.WithRounds(100),
bayesopt.WithMinimize(true))
x, y, err := o.Optimize(objective)
if err != nil { ... }
log.Printf(...)
}
x1
x2

 



$ go get github.com/c-bata/goptuna
package main
import (
"log"
"math"
"github.com/c-bata/goptuna"
"github.com/c-bata/goptuna/tpe"
)
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() {
study, _ := goptuna.CreateStudy(
"goptuna-example",
goptuna.StudyOptionSampler(tpe.NewSampler()))
err = study.Optimize(objective, 100)
if err != nil { ... }
v, _ := study.GetBestValue()
params, _ := study.GetBestParams()
log.Printf(...)
}
package main
import (
"log"
"math"
"github.com/c-bata/goptuna"
"github.com/c-bata/goptuna/tpe"
)
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() {
study, _ := goptuna.CreateStudy(
"goptuna-example",
goptuna.StudyOptionSampler(tpe.NewSampler()))
err = study.Optimize(objective, 100)
if err != nil { ... }
v, _ := study.GetBestValue()
params, _ := study.GetBestParams()
log.Printf(...)
}
goptuna.Trial
float64 error
package main
import (
"log"
"math"
"github.com/c-bata/goptuna"
"github.com/c-bata/goptuna/tpe"
)
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() {
study, _ := goptuna.CreateStudy(
"goptuna-example",
goptuna.StudyOptionSampler(tpe.NewSampler()))
err = study.Optimize(objective, 100)
if err != nil { ... }
v, _ := study.GetBestValue()
params, _ := study.GetBestParams()
log.Printf(...)
}
(x1, x2) = (2, -5)
package main
import (
"log"
"math"
"github.com/c-bata/goptuna"
"github.com/c-bata/goptuna/tpe"
)
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() {
study, _ := goptuna.CreateStudy(
"goptuna-example",
goptuna.StudyOptionSampler(tpe.NewSampler()))
err = study.Optimize(objective, 100)
if err != nil { ... }
v, _ := study.GetBestValue()
params, _ := study.GetBestParams()
log.Printf(...)
}
SuggestUniform SuggestLogUniform
SuggestInt SuggestCategorical
x1 x2
[-10, 10]
package main
import (
"log"
"math"
"github.com/c-bata/goptuna"
"github.com/c-bata/goptuna/tpe"
)
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() {
study, _ := goptuna.CreateStudy(
"goptuna-example",
goptuna.StudyOptionSampler(tpe.NewSampler()))
err = study.Optimize(objective, 100)
if err != nil { ... }
v, _ := study.GetBestValue()
params, _ := study.GetBestParams()
log.Printf(...)
}
package main
import (
"log"
"math"
"github.com/c-bata/goptuna"
"github.com/c-bata/goptuna/tpe"
)
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() {
study, _ := goptuna.CreateStudy(
"goptuna-example",
goptuna.StudyOptionSampler(tpe.NewSampler()))
err = study.Optimize(objective, 100)
if err != nil { ... }
v, _ := study.GetBestValue()
params, _ := study.GetBestParams()
log.Printf(...)
}
package main
import (
"log"
"math"
"github.com/c-bata/goptuna"
"github.com/c-bata/goptuna/tpe"
)
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() {
study, _ := goptuna.CreateStudy(
"goptuna-example",
goptuna.StudyOptionSampler(tpe.NewSampler()))
err = study.Optimize(objective, 100)
if err != nil { ... }
v, _ := study.GetBestValue()
params, _ := study.GetBestParams()
log.Printf(...)
}
package main
import (
"log"
"math"
"github.com/c-bata/goptuna"
"github.com/c-bata/goptuna/tpe"
)
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() {
study, _ := goptuna.CreateStudy(
"goptuna-example",
goptuna.StudyOptionSampler(tpe.NewSampler()))
err = study.Optimize(objective, 100)
if err != nil { ... }
v, _ := study.GetBestValue()
params, _ := study.GetBestParams()
log.Printf(...)
}
$ go run _examples/simple_tpe/main.go
2019/10/28 01:55:34 [INFO] Trial finished: trialID=0 state=Complete evaluation=47.674293
2019/10/28 01:55:34 [INFO] Trial finished: trialID=1 state=Complete evaluation=16.564975
2019/10/28 01:55:34 [INFO] Trial finished: trialID=2 state=Complete evaluation=22.229764
2019/10/28 01:55:34 [INFO] Trial finished: trialID=3 state=Complete evaluation=132.160176
2019/10/28 01:55:34 [INFO] Trial finished: trialID=4 state=Complete evaluation=38.056051
:
2019/10/28 01:55:34 Best evaluation=0.038327 (x1=2.181604, x2=-4.926880)
package main
import (
"github.com/c-bata/goptuna"
"github.com/c-bata/goptuna/rdb"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
)
func main() {
db, err := gorm.Open("sqlite3", "db.sqlite3")
if err != nil { ... }
defer db.Close()
db.DB().SetMaxOpenConns(1)
rdb.RunAutoMigrate(db)
storage := rdb.NewStorage(db)
study, _ := goptuna.LoadStudy(
"study-name",
goptuna.StudyOptionStorage(storage))
...
}
$ pip install optuna bokeh mysqlclient
$ optuna dashboard 
> --storage mysql+mysqldb://
goptuna:password@127.0.0.1:3306/yourdb 
> -—study yourstudy
import ...
func main() {
db, _ := gorm.Open(“mysql",
“user:pass@tcp(localhost:3306)/yourdb" +
”?parseTime=true”)
storage := rdb.NewStorage(db)
defer db.Close()
study, _ := goptuna.LoadStudy(
“study-name",
goptuna.StudyOptionStorage(storage))
...
}
$ goptuna create-study 
> --storage mysql+mysqldb://
goptuna:password@127.0.0.1:3306/yourdb 
> -—study yourstudy
goputna.LoadStudy study
: _examples/concurrency
• optuna.visualization.plot_contour(st
udy)
• optuna.visualization.
plot_intermediate_values(study)
• optuna.visualization.plot_optimizati
on_history(study)
• optuna.visualization.plot_parallel_c
oordinate(study)
• optuna.visualization.plot_slice(stud
y)
package main
import (
"log"
"math"
bo "github.com/d4l3k/go-bayesopt"
)
var (
px1 = bo.UniformParam{Name: "X1", Max: 10, Min: -10}
px2 = bo.UniformParam{Name: "X2", Max: 10, Min: -10}
searchSpace = []bo.Param{px1, px2}
)
func objective(params map[bo.Param]float64) float64 {
x1 := params[px1]
x2 := params[px2]
return math.Pow(x1-1, 2) + math.Pow(x2-2, 2)
}
func main() {
o := bo.New(
searchSpace,
bo.WithRandomRounds(10),
bo.WithRounds(100),
bo.WithMinimize(true))
x, y, err := o.Optimize(objective)
if err != nil { ... }
log.Printf(...)
}
package main
import (
"log"
"math"
"github.com/c-bata/goptuna"
"github.com/c-bata/goptuna/tpe"
)
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() {
study, _ := goptuna.CreateStudy(
"goptuna-example",
goptuna.StudyOptionSampler(tpe.NewSampler()))
err = study.Optimize(objective, 100)
if err != nil { ... }
v, _ := study.GetBestValue()
params, _ := study.GetBestParams()
log.Printf(...)
}
Define-and-Run interface
go-bayesopt
Define-by-Run interface
Goptuna




10 epochs
trial #1
trial #2
trial #3
trial #4
trial #5
trial #6
trial #7
trial #8
trial #9
30 epochs 90 epochs
[Jamieson and Talwalkar, 2016] [Li et al., 2018]


2,010
10,660
1 ISUCON Alibaba Cloud ecs.sn1ne.large (vCPUx2, Mem 4.0GiB) 3
2 ISUCON9 9560 9100
func objective(trial goptuna.Trial) (float64, error) {
// Go application
goMySQLOpenConns, _ := trial.SuggestInt("mysql_client_open_conns", 1, 64)
goMySQLIdleConns, _ := trial.SuggestInt("mysql_client_idle_conns", 1, 64)
goMySQLMaxLifetime, _ := trial.SuggestInt("mysql_client_max_lifetime", 1, 128)
goHttpIdleConnsPerHost, _ := trial.SuggestInt("http_max_idle_conns_per_host", 1, 4096)
goHttpKeepAlive, _ := trial.SuggestInt("http_keep_alive_timeout", 1, 128)
campaign, _ := trial.SuggestInt("campaign", 0, 2)
// Nginx
nginxWorkerProcesses, _ := trial.SuggestInt("nginx_worker_processes", 1, 16)
nginxWorkerConns, _ := trial.SuggestInt("nginx_worker_connections", 1, 4096)
nginxKeepAliveTimeout, _ := trial.SuggestInt("nginx_keep_alive_timeout", 1, 100)
// MySQL
innoDBBufferPoolSize, _ := trial.SuggestInt("innodb_buffer_pool_size", 10, 3800)
innoDBFlushLogAtTRXCommit, _ := trial.SuggestCategorical(“innodb_flush_log_at_trx_commit",
[]string{"0", "1", "2"})
innodbFlushMethod, _ := trial.SuggestCategorical("innodb_flush_method", []string{
"fsync",
"littlesync",
"nosync",
"O_DIRECT",
"O_DIRECT_NO_FSYNC",
})
...
} https://github.com/c-bata/goptuna-isucon9q/blob/master/optimizer/main.go
func objective(trial goptuna.Trial) (float64, error) {
// Go application
goMySQLOpenConns, _ := trial.SuggestInt("mysql_client_open_conns", 1, 64)
goMySQLIdleConns, _ := trial.SuggestInt("mysql_client_idle_conns", 1, 64)
goMySQLMaxLifetime, _ := trial.SuggestInt("mysql_client_max_lifetime", 1, 128)
goHttpIdleConnsPerHost, _ := trial.SuggestInt("http_max_idle_conns_per_host", 1, 4096)
goHttpKeepAlive, _ := trial.SuggestInt("http_keep_alive_timeout", 1, 128)
campaign, _ := trial.SuggestInt("campaign", 0, 2)
// Nginx
nginxWorkerProcesses, _ := trial.SuggestInt("nginx_worker_processes", 1, 16)
nginxWorkerConns, _ := trial.SuggestInt("nginx_worker_connections", 1, 4096)
nginxKeepAliveTimeout, _ := trial.SuggestInt("nginx_keep_alive_timeout", 1, 100)
// MySQL
innoDBBufferPoolSize, _ := trial.SuggestInt("innodb_buffer_pool_size", 10, 3800)
innoDBFlushLogAtTRXCommit, _ := trial.SuggestCategorical(“innodb_flush_log_at_trx_commit",
[]string{"0", "1", "2"})
innodbFlushMethod, _ := trial.SuggestCategorical("innodb_flush_method", []string{
"fsync",
"littlesync",
"nosync",
"O_DIRECT",
"O_DIRECT_NO_FSYNC",
})
...
} https://github.com/c-bata/goptuna-isucon9q/blob/master/optimizer/main.go
(database/sql).DB
func objective(trial goptuna.Trial) (float64, error) {
// Go application
goMySQLOpenConns, _ := trial.SuggestInt("mysql_client_open_conns", 1, 64)
goMySQLIdleConns, _ := trial.SuggestInt("mysql_client_idle_conns", 1, 64)
goMySQLMaxLifetime, _ := trial.SuggestInt("mysql_client_max_lifetime", 1, 128)
goHttpIdleConnsPerHost, _ := trial.SuggestInt("http_max_idle_conns_per_host", 1, 4096)
goHttpKeepAlive, _ := trial.SuggestInt("http_keep_alive_timeout", 1, 128)
campaign, _ := trial.SuggestInt("campaign", 0, 2)
// Nginx
nginxWorkerProcesses, _ := trial.SuggestInt("nginx_worker_processes", 1, 16)
nginxWorkerConns, _ := trial.SuggestInt("nginx_worker_connections", 1, 4096)
nginxKeepAliveTimeout, _ := trial.SuggestInt("nginx_keep_alive_timeout", 1, 100)
// MySQL
innoDBBufferPoolSize, _ := trial.SuggestInt("innodb_buffer_pool_size", 10, 3800)
innoDBFlushLogAtTRXCommit, _ := trial.SuggestCategorical(“innodb_flush_log_at_trx_commit",
[]string{"0", "1", "2"})
innodbFlushMethod, _ := trial.SuggestCategorical("innodb_flush_method", []string{
"fsync",
"littlesync",
"nosync",
"O_DIRECT",
"O_DIRECT_NO_FSYNC",
})
...
} https://github.com/c-bata/goptuna-isucon9q/blob/master/optimizer/main.go
API 

(net/http).Client
func objective(trial goptuna.Trial) (float64, error) {
// Go application
goMySQLOpenConns, _ := trial.SuggestInt("mysql_client_open_conns", 1, 64)
goMySQLIdleConns, _ := trial.SuggestInt("mysql_client_idle_conns", 1, 64)
goMySQLMaxLifetime, _ := trial.SuggestInt("mysql_client_max_lifetime", 1, 128)
goHttpIdleConnsPerHost, _ := trial.SuggestInt("http_max_idle_conns_per_host", 1, 4096)
goHttpKeepAlive, _ := trial.SuggestInt("http_keep_alive_timeout", 1, 128)
campaign, _ := trial.SuggestInt("campaign", 0, 2)
// Nginx
nginxWorkerProcesses, _ := trial.SuggestInt("nginx_worker_processes", 1, 16)
nginxWorkerConns, _ := trial.SuggestInt("nginx_worker_connections", 1, 4096)
nginxKeepAliveTimeout, _ := trial.SuggestInt("nginx_keep_alive_timeout", 1, 100)
// MySQL
innoDBBufferPoolSize, _ := trial.SuggestInt("innodb_buffer_pool_size", 10, 3800)
innoDBFlushLogAtTRXCommit, _ := trial.SuggestCategorical(“innodb_flush_log_at_trx_commit",
[]string{"0", "1", "2"})
innodbFlushMethod, _ := trial.SuggestCategorical("innodb_flush_method", []string{
"fsync",
"littlesync",
"nosync",
"O_DIRECT",
"O_DIRECT_NO_FSYNC",
})
...
} https://github.com/c-bata/goptuna-isucon9q/blob/master/optimizer/main.go
campaign: 

func objective(trial goptuna.Trial) (float64, error) {
// Go application
goMySQLOpenConns, _ := trial.SuggestInt("mysql_client_open_conns", 1, 64)
goMySQLIdleConns, _ := trial.SuggestInt("mysql_client_idle_conns", 1, 64)
goMySQLMaxLifetime, _ := trial.SuggestInt("mysql_client_max_lifetime", 1, 128)
goHttpIdleConnsPerHost, _ := trial.SuggestInt("http_max_idle_conns_per_host", 1, 4096)
goHttpKeepAlive, _ := trial.SuggestInt("http_keep_alive_timeout", 1, 128)
campaign, _ := trial.SuggestInt("campaign", 0, 2)
// Nginx
nginxWorkerProcesses, _ := trial.SuggestInt("nginx_worker_processes", 1, 16)
nginxWorkerConns, _ := trial.SuggestInt("nginx_worker_connections", 1, 4096)
nginxKeepAliveTimeout, _ := trial.SuggestInt("nginx_keep_alive_timeout", 1, 100)
// MySQL
innoDBBufferPoolSize, _ := trial.SuggestInt("innodb_buffer_pool_size", 10, 3800)
innoDBFlushLogAtTRXCommit, _ := trial.SuggestCategorical(“innodb_flush_log_at_trx_commit",
[]string{"0", "1", "2"})
innodbFlushMethod, _ := trial.SuggestCategorical("innodb_flush_method", []string{
"fsync",
"littlesync",
"nosync",
"O_DIRECT",
"O_DIRECT_NO_FSYNC",
})
...
} https://github.com/c-bata/goptuna-isucon9q/blob/master/optimizer/main.go
Nginx
suggest text/template
nginx.conf systemd
func objective(trial goptuna.Trial) (float64, error) {
// Go application
goMySQLOpenConns, _ := trial.SuggestInt("mysql_client_open_conns", 1, 64)
goMySQLIdleConns, _ := trial.SuggestInt("mysql_client_idle_conns", 1, 64)
goMySQLMaxLifetime, _ := trial.SuggestInt("mysql_client_max_lifetime", 1, 128)
goHttpIdleConnsPerHost, _ := trial.SuggestInt("http_max_idle_conns_per_host", 1, 4096)
goHttpKeepAlive, _ := trial.SuggestInt("http_keep_alive_timeout", 1, 128)
campaign, _ := trial.SuggestInt("campaign", 0, 2)
// Nginx
nginxWorkerProcesses, _ := trial.SuggestInt("nginx_worker_processes", 1, 16)
nginxWorkerConns, _ := trial.SuggestInt("nginx_worker_connections", 1, 4096)
nginxKeepAliveTimeout, _ := trial.SuggestInt("nginx_keep_alive_timeout", 1, 100)
// MySQL
innoDBBufferPoolSize, _ := trial.SuggestInt("innodb_buffer_pool_size", 10, 3800)
innoDBFlushLogAtTRXCommit, _ := trial.SuggestCategorical(“innodb_flush_log_at_trx_commit",
[]string{"0", "1", "2"})
innodbFlushMethod, _ := trial.SuggestCategorical("innodb_flush_method", []string{
"fsync",
"littlesync",
"nosync",
"O_DIRECT",
"O_DIRECT_NO_FSYNC",
})
...
} https://github.com/c-bata/goptuna-isucon9q/blob/master/optimizer/main.go
MySQL
Nginx
Go MySQL client (net/http).Client Nginx MySQL
SetMaxOpen
Conns
SetMaxIdleC
onns
SetConnMax
Lifetime
DialContext.
Keepalive
MaxIdleConn
sPerHost
worker_proc
esses
worker_conn
ections
keep_alive_ti
meout
innodb_buffe
r_pool_size
innodb_flush
_log_at_trx_c
ommit
innodb_flush
_method
10660
11160

(+500)
200 37 53 77s 40s 709 11 367 74s 711M 0 fsync

 

Go MySQL client Nginx MySQL
SetMaxOpenCo
nns
SetMaxIdleConn
s
SetConnMaxLife
time
worker_connecti
ons
innodb_buffer_p
ool_size
innodb_flush_log
_at_trx_commit
innodb_log_buff
er_size
innodb_log_file_
size
2010
2310

(+300)
50 23 4 28s 5 210M 0 27M 341M
https://github.com/c-bata/goptuna-isucon9q/issues/2
https://github.com/c-bata/goptuna-isucon9q/issues/9
Optuna x.264
(by Takeru Ohta a.k.a. @sile)
x.264
https://gist.github.com/sile/8aa1ff7808dd55298f51dd70c8b83092
• Goptuna

LibFFM [Juan et al., 2016] 

• Optuna

RocsDB by @sile

• BoTorch/Ax (Facebook)

HHVM JIT Compiler 

• [Eric et al., 2010] Eric Brochu, Vlad M. Cora, and Nando de Freitas. A tutorial on Bayesian optimization of expensive cost
functions, with application to active user modeling and hierarchical reinforcement learning. 2010. arXiv:1012.2599.

• [James et al., 2011] James S. Bergstra, Remi Bardenet, Yoshua Bengio, and Balázs Kégl. Algorithms for hyper-
parameter optimization. In Advances in Neural Information Processing Systems 25. 2011.

• [Akiba at el., 2019] Takuya Akiba, Shotaro Sano, Toshihiko Yanase, Takeru Ohta, Masanori Koyama. 2019. Optuna: A
Next-generation Hyperparameter Optimization Framework. In The 25th ACM SIGKDD Conference on Knowledge
Discovery and Data Mining (KDD ’19), August 4–8, 2019.

• [Jamieson and Talwalkar, 2016] K. Jamieson and A. Talwalkar. Non-stochastic best arm identification and
hyperparameter optimization. In AISTATS, 2016.

• [Li et al., 2018] Liam Li, Kevin Jamieson, Afshin Rostamizadeh, Ekaterina Gonina, Moritz Hardt, Benjamin Recht, and
Ameet Talwalkar. Massively parallel hyperparameter tuning. arXiv preprint arXiv:1810.05934, 2018.

• [Eggensperger et al., 2013] Eggensperger, K., Feurer, M., Hutter, F., Bergstra, J., Snoek, J., Hoos, H., and Leyton-Brown,
K.: Towards an Empirical Foundation for Assessing Bayesian Optimization of Hyperparameters, in NeurIPS workshop on
Bayesian Optimization in Theory and Practice (2013).

• [Juan et al., 2016] Yu-Chin Juan, Yong Zhuang, Wei-Sheng Chin, and Chih-Jen Lin. Field-aware factorization machines
for CTR prediction. In RecSys, pages 43–50, 2016.
References
THANK YOU
https://speakerdeck.com/nmasahiro/ji-jie-xue-xi-niokeru-haihaharametazui-shi-hua-falseli-lun-toshi-jian?slide=52

Contenu connexe

Tendances

Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at Stripe
MongoDB
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
Remy Sharp
 

Tendances (20)

Python tour
Python tourPython tour
Python tour
 
Damn Fine CoffeeScript
Damn Fine CoffeeScriptDamn Fine CoffeeScript
Damn Fine CoffeeScript
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at Stripe
 
ES6 Overview
ES6 OverviewES6 Overview
ES6 Overview
 
Google Guava - Core libraries for Java & Android
Google Guava - Core libraries for Java & AndroidGoogle Guava - Core libraries for Java & Android
Google Guava - Core libraries for Java & Android
 
TDC2016SP - Código funcional em Java: superando o hype
TDC2016SP - Código funcional em Java: superando o hypeTDC2016SP - Código funcional em Java: superando o hype
TDC2016SP - Código funcional em Java: superando o hype
 
The Ring programming language version 1.7 book - Part 16 of 196
The Ring programming language version 1.7 book - Part 16 of 196The Ring programming language version 1.7 book - Part 16 of 196
The Ring programming language version 1.7 book - Part 16 of 196
 
Go 프로그래밍 소개 - 장재휴, DomainDriven커뮤니티
Go 프로그래밍 소개 - 장재휴, DomainDriven커뮤니티Go 프로그래밍 소개 - 장재휴, DomainDriven커뮤니티
Go 프로그래밍 소개 - 장재휴, DomainDriven커뮤니티
 
Groovy collection api
Groovy collection apiGroovy collection api
Groovy collection api
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
 
Python basic
Python basic Python basic
Python basic
 
CoffeeScript
CoffeeScriptCoffeeScript
CoffeeScript
 
Introducción a Elixir
Introducción a ElixirIntroducción a Elixir
Introducción a Elixir
 
"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014
 
yt: An Analysis and Visualization System for Astrophysical Simulation Data
yt: An Analysis and Visualization System for Astrophysical Simulation Datayt: An Analysis and Visualization System for Astrophysical Simulation Data
yt: An Analysis and Visualization System for Astrophysical Simulation Data
 
Statistical computing 01
Statistical computing 01Statistical computing 01
Statistical computing 01
 
Python postgre sql a wonderful wedding
Python postgre sql   a wonderful weddingPython postgre sql   a wonderful wedding
Python postgre sql a wonderful wedding
 
Backbone.js: Run your Application Inside The Browser
Backbone.js: Run your Application Inside The BrowserBackbone.js: Run your Application Inside The Browser
Backbone.js: Run your Application Inside The Browser
 
Unit testing pig
Unit testing pigUnit testing pig
Unit testing pig
 
Машинное обучение на JS. С чего начать и куда идти | Odessa Frontend Meetup #12
Машинное обучение на JS. С чего начать и куда идти | Odessa Frontend Meetup #12Машинное обучение на JS. С чего начать и куда идти | Odessa Frontend Meetup #12
Машинное обучение на JS. С чего начать и куда идти | Odessa Frontend Meetup #12
 

Similaire à Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn

Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
Dmitry Buzdin
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
ConFoo
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
julien.ponge
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
Dmitry Soshnikov
 
Python utan-stodhjul-motorsag
Python utan-stodhjul-motorsagPython utan-stodhjul-motorsag
Python utan-stodhjul-motorsag
niklal
 
Gevent what's the point
Gevent what's the pointGevent what's the point
Gevent what's the point
seanmcq
 

Similaire à Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn (20)

PyCon KR 2019 sprint - RustPython by example
PyCon KR 2019 sprint  - RustPython by examplePyCon KR 2019 sprint  - RustPython by example
PyCon KR 2019 sprint - RustPython by example
 
Java VS Python
Java VS PythonJava VS Python
Java VS Python
 
Groovy kind of test
Groovy kind of testGroovy kind of test
Groovy kind of test
 
Groovy kind of test
Groovy kind of testGroovy kind of test
Groovy kind of test
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
Testing My Patience
Testing My PatienceTesting My Patience
Testing My Patience
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
 
What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11
 
Django Celery
Django Celery Django Celery
Django Celery
 
The Ring programming language version 1.5.3 book - Part 10 of 184
The Ring programming language version 1.5.3 book - Part 10 of 184The Ring programming language version 1.5.3 book - Part 10 of 184
The Ring programming language version 1.5.3 book - Part 10 of 184
 
Python Development (MongoSF)
Python Development (MongoSF)Python Development (MongoSF)
Python Development (MongoSF)
 
Practical Google App Engine Applications In Py
Practical Google App Engine Applications In PyPractical Google App Engine Applications In Py
Practical Google App Engine Applications In Py
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
 
Python utan-stodhjul-motorsag
Python utan-stodhjul-motorsagPython utan-stodhjul-motorsag
Python utan-stodhjul-motorsag
 
MySQL in Go - Golang NE July 2015
MySQL in Go - Golang NE July 2015MySQL in Go - Golang NE July 2015
MySQL in Go - Golang NE July 2015
 
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
 
Gevent what's the point
Gevent what's the pointGevent what's the point
Gevent what's the point
 
Google App Engine Developer - Day3
Google App Engine Developer - Day3Google App Engine Developer - Day3
Google App Engine Developer - Day3
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
 

Plus de Masashi Shibata

MLOps Case Studies: Building fast, scalable, and high-accuracy ML systems at ...
MLOps Case Studies: Building fast, scalable, and high-accuracy ML systems at ...MLOps Case Studies: Building fast, scalable, and high-accuracy ML systems at ...
MLOps Case Studies: Building fast, scalable, and high-accuracy ML systems at ...
Masashi Shibata
 
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django applicationDjangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Masashi Shibata
 

Plus de Masashi Shibata (20)

MLOps Case Studies: Building fast, scalable, and high-accuracy ML systems at ...
MLOps Case Studies: Building fast, scalable, and high-accuracy ML systems at ...MLOps Case Studies: Building fast, scalable, and high-accuracy ML systems at ...
MLOps Case Studies: Building fast, scalable, and high-accuracy ML systems at ...
 
実践Djangoの読み方 - みんなのPython勉強会 #72
実践Djangoの読み方 - みんなのPython勉強会 #72実践Djangoの読み方 - みんなのPython勉強会 #72
実践Djangoの読み方 - みんなのPython勉強会 #72
 
CMA-ESサンプラーによるハイパーパラメータ最適化 at Optuna Meetup #1
CMA-ESサンプラーによるハイパーパラメータ最適化 at Optuna Meetup #1CMA-ESサンプラーによるハイパーパラメータ最適化 at Optuna Meetup #1
CMA-ESサンプラーによるハイパーパラメータ最適化 at Optuna Meetup #1
 
サイバーエージェントにおけるMLOpsに関する取り組み at PyDataTokyo 23
サイバーエージェントにおけるMLOpsに関する取り組み at PyDataTokyo 23サイバーエージェントにおけるMLOpsに関する取り組み at PyDataTokyo 23
サイバーエージェントにおけるMLOpsに関する取り組み at PyDataTokyo 23
 
Implementing sobol's quasirandom sequence generator
Implementing sobol's quasirandom sequence generatorImplementing sobol's quasirandom sequence generator
Implementing sobol's quasirandom sequence generator
 
DARTS: Differentiable Architecture Search at 社内論文読み会
DARTS: Differentiable Architecture Search at 社内論文読み会DARTS: Differentiable Architecture Search at 社内論文読み会
DARTS: Differentiable Architecture Search at 社内論文読み会
 
PythonとAutoML at PyConJP 2019
PythonとAutoML at PyConJP 2019PythonとAutoML at PyConJP 2019
PythonとAutoML at PyConJP 2019
 
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django applicationDjangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django application
 
Django REST Framework における API 実装プラクティス | PyCon JP 2018
Django REST Framework における API 実装プラクティス | PyCon JP 2018Django REST Framework における API 実装プラクティス | PyCon JP 2018
Django REST Framework における API 実装プラクティス | PyCon JP 2018
 
Django の認証処理実装パターン / Django Authentication Patterns
Django の認証処理実装パターン / Django Authentication PatternsDjango の認証処理実装パターン / Django Authentication Patterns
Django の認証処理実装パターン / Django Authentication Patterns
 
RTMPのはなし - RTMP1.0の仕様とコンセプト / Concepts and Specification of RTMP
RTMPのはなし - RTMP1.0の仕様とコンセプト / Concepts and Specification of RTMPRTMPのはなし - RTMP1.0の仕様とコンセプト / Concepts and Specification of RTMP
RTMPのはなし - RTMP1.0の仕様とコンセプト / Concepts and Specification of RTMP
 
システムコールトレーサーの動作原理と実装 (Writing system call tracer for Linux/x86)
システムコールトレーサーの動作原理と実装 (Writing system call tracer for Linux/x86)システムコールトレーサーの動作原理と実装 (Writing system call tracer for Linux/x86)
システムコールトレーサーの動作原理と実装 (Writing system call tracer for Linux/x86)
 
Golangにおける端末制御 リッチなターミナルUIの実現方法
Golangにおける端末制御 リッチなターミナルUIの実現方法Golangにおける端末制御 リッチなターミナルUIの実現方法
Golangにおける端末制御 リッチなターミナルUIの実現方法
 
How to develop a rich terminal UI application
How to develop a rich terminal UI applicationHow to develop a rich terminal UI application
How to develop a rich terminal UI application
 
Introduction of Feedy
Introduction of FeedyIntroduction of Feedy
Introduction of Feedy
 
Webフレームワークを作ってる話 #osakapy
Webフレームワークを作ってる話 #osakapyWebフレームワークを作ってる話 #osakapy
Webフレームワークを作ってる話 #osakapy
 
Pythonのすすめ
PythonのすすめPythonのすすめ
Pythonのすすめ
 
pandasによるデータ加工時の注意点やライブラリの話
pandasによるデータ加工時の注意点やライブラリの話pandasによるデータ加工時の注意点やライブラリの話
pandasによるデータ加工時の注意点やライブラリの話
 
Pythonistaのためのデータ分析入門 - C4K Meetup #3
Pythonistaのためのデータ分析入門 - C4K Meetup #3Pythonistaのためのデータ分析入門 - C4K Meetup #3
Pythonistaのためのデータ分析入門 - C4K Meetup #3
 
テスト駆動開発入門 - C4K Meetup#2
テスト駆動開発入門 - C4K Meetup#2テスト駆動開発入門 - C4K Meetup#2
テスト駆動開発入門 - C4K Meetup#2
 

Dernier

%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 

Dernier (20)

%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 

Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn

  • 1. Go Conference 2019 Autumn c-bata c_bata_ Distributed Bayesian Optimization Framework Goptuna
  • 2. CyberAgent AI Lab Masashi SHIBATA c-bata c_bata_ Python go-prompt, kube-prompt
  • 5.
  • 6. y = f(x)x y y x
  • 7.
  • 10.
  • 11. Grid Search / Random Search
  • 12. [Eric et al., 2010]
  • 13. [Eric et al., 2010] • : • : • : 
 ( )
  • 14. [Eric et al., 2010] ( )
  • 15. [Eric et al., 2010] ( )
  • 16. [Eric et al., 2010] L-BFGS
  • 17. [Eric et al., 2010]
  • 18. [Eric et al., 2010]
  • 19.
  • 20. package main import ( "log" "math" bayesopt "github.com/d4l3k/go-bayesopt" ) var ( px1 = bayesopt.UniformParam{Name: "X1", Max: 10, Min: -10} px2 = bayesopt.UniformParam{Name: "X2", Max: 10, Min: -10} searchSpace = []bayesopt.Param{px1, px2} ) func objective(params map[bayesopt.Param]float64) float64 { x1 := params[px1] x2 := params[px2] return math.Pow(x1-1, 2) + math.Pow(x2-2, 2) } func main() { o := bayesopt.New( searchSpace, bayesopt.WithRandomRounds(10), bayesopt.WithRounds(100), bayesopt.WithMinimize(true)) x, y, err := o.Optimize(objective) if err != nil { ... } log.Printf(...) }
  • 22.
  • 23. 
 $ go get github.com/c-bata/goptuna
  • 24. package main import ( "log" "math" "github.com/c-bata/goptuna" "github.com/c-bata/goptuna/tpe" ) 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() { study, _ := goptuna.CreateStudy( "goptuna-example", goptuna.StudyOptionSampler(tpe.NewSampler())) err = study.Optimize(objective, 100) if err != nil { ... } v, _ := study.GetBestValue() params, _ := study.GetBestParams() log.Printf(...) }
  • 25. package main import ( "log" "math" "github.com/c-bata/goptuna" "github.com/c-bata/goptuna/tpe" ) 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() { study, _ := goptuna.CreateStudy( "goptuna-example", goptuna.StudyOptionSampler(tpe.NewSampler())) err = study.Optimize(objective, 100) if err != nil { ... } v, _ := study.GetBestValue() params, _ := study.GetBestParams() log.Printf(...) } goptuna.Trial float64 error
  • 26. package main import ( "log" "math" "github.com/c-bata/goptuna" "github.com/c-bata/goptuna/tpe" ) 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() { study, _ := goptuna.CreateStudy( "goptuna-example", goptuna.StudyOptionSampler(tpe.NewSampler())) err = study.Optimize(objective, 100) if err != nil { ... } v, _ := study.GetBestValue() params, _ := study.GetBestParams() log.Printf(...) } (x1, x2) = (2, -5)
  • 27. package main import ( "log" "math" "github.com/c-bata/goptuna" "github.com/c-bata/goptuna/tpe" ) 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() { study, _ := goptuna.CreateStudy( "goptuna-example", goptuna.StudyOptionSampler(tpe.NewSampler())) err = study.Optimize(objective, 100) if err != nil { ... } v, _ := study.GetBestValue() params, _ := study.GetBestParams() log.Printf(...) } SuggestUniform SuggestLogUniform SuggestInt SuggestCategorical x1 x2 [-10, 10]
  • 28. package main import ( "log" "math" "github.com/c-bata/goptuna" "github.com/c-bata/goptuna/tpe" ) 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() { study, _ := goptuna.CreateStudy( "goptuna-example", goptuna.StudyOptionSampler(tpe.NewSampler())) err = study.Optimize(objective, 100) if err != nil { ... } v, _ := study.GetBestValue() params, _ := study.GetBestParams() log.Printf(...) }
  • 29. package main import ( "log" "math" "github.com/c-bata/goptuna" "github.com/c-bata/goptuna/tpe" ) 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() { study, _ := goptuna.CreateStudy( "goptuna-example", goptuna.StudyOptionSampler(tpe.NewSampler())) err = study.Optimize(objective, 100) if err != nil { ... } v, _ := study.GetBestValue() params, _ := study.GetBestParams() log.Printf(...) }
  • 30. package main import ( "log" "math" "github.com/c-bata/goptuna" "github.com/c-bata/goptuna/tpe" ) 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() { study, _ := goptuna.CreateStudy( "goptuna-example", goptuna.StudyOptionSampler(tpe.NewSampler())) err = study.Optimize(objective, 100) if err != nil { ... } v, _ := study.GetBestValue() params, _ := study.GetBestParams() log.Printf(...) }
  • 31. package main import ( "log" "math" "github.com/c-bata/goptuna" "github.com/c-bata/goptuna/tpe" ) 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() { study, _ := goptuna.CreateStudy( "goptuna-example", goptuna.StudyOptionSampler(tpe.NewSampler())) err = study.Optimize(objective, 100) if err != nil { ... } v, _ := study.GetBestValue() params, _ := study.GetBestParams() log.Printf(...) } $ go run _examples/simple_tpe/main.go 2019/10/28 01:55:34 [INFO] Trial finished: trialID=0 state=Complete evaluation=47.674293 2019/10/28 01:55:34 [INFO] Trial finished: trialID=1 state=Complete evaluation=16.564975 2019/10/28 01:55:34 [INFO] Trial finished: trialID=2 state=Complete evaluation=22.229764 2019/10/28 01:55:34 [INFO] Trial finished: trialID=3 state=Complete evaluation=132.160176 2019/10/28 01:55:34 [INFO] Trial finished: trialID=4 state=Complete evaluation=38.056051 : 2019/10/28 01:55:34 Best evaluation=0.038327 (x1=2.181604, x2=-4.926880)
  • 32.
  • 33. package main import ( "github.com/c-bata/goptuna" "github.com/c-bata/goptuna/rdb" "github.com/jinzhu/gorm" _ "github.com/jinzhu/gorm/dialects/sqlite" ) func main() { db, err := gorm.Open("sqlite3", "db.sqlite3") if err != nil { ... } defer db.Close() db.DB().SetMaxOpenConns(1) rdb.RunAutoMigrate(db) storage := rdb.NewStorage(db) study, _ := goptuna.LoadStudy( "study-name", goptuna.StudyOptionStorage(storage)) ... }
  • 34. $ pip install optuna bokeh mysqlclient $ optuna dashboard > --storage mysql+mysqldb:// goptuna:password@127.0.0.1:3306/yourdb > -—study yourstudy
  • 35. import ... func main() { db, _ := gorm.Open(“mysql", “user:pass@tcp(localhost:3306)/yourdb" + ”?parseTime=true”) storage := rdb.NewStorage(db) defer db.Close() study, _ := goptuna.LoadStudy( “study-name", goptuna.StudyOptionStorage(storage)) ... } $ goptuna create-study > --storage mysql+mysqldb:// goptuna:password@127.0.0.1:3306/yourdb > -—study yourstudy goputna.LoadStudy study : _examples/concurrency
  • 36. • optuna.visualization.plot_contour(st udy) • optuna.visualization. plot_intermediate_values(study) • optuna.visualization.plot_optimizati on_history(study) • optuna.visualization.plot_parallel_c oordinate(study) • optuna.visualization.plot_slice(stud y)
  • 37. package main import ( "log" "math" bo "github.com/d4l3k/go-bayesopt" ) var ( px1 = bo.UniformParam{Name: "X1", Max: 10, Min: -10} px2 = bo.UniformParam{Name: "X2", Max: 10, Min: -10} searchSpace = []bo.Param{px1, px2} ) func objective(params map[bo.Param]float64) float64 { x1 := params[px1] x2 := params[px2] return math.Pow(x1-1, 2) + math.Pow(x2-2, 2) } func main() { o := bo.New( searchSpace, bo.WithRandomRounds(10), bo.WithRounds(100), bo.WithMinimize(true)) x, y, err := o.Optimize(objective) if err != nil { ... } log.Printf(...) } package main import ( "log" "math" "github.com/c-bata/goptuna" "github.com/c-bata/goptuna/tpe" ) 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() { study, _ := goptuna.CreateStudy( "goptuna-example", goptuna.StudyOptionSampler(tpe.NewSampler())) err = study.Optimize(objective, 100) if err != nil { ... } v, _ := study.GetBestValue() params, _ := study.GetBestParams() log.Printf(...) } Define-and-Run interface go-bayesopt Define-by-Run interface Goptuna
  • 38. 
 
 10 epochs trial #1 trial #2 trial #3 trial #4 trial #5 trial #6 trial #7 trial #8 trial #9 30 epochs 90 epochs [Jamieson and Talwalkar, 2016] [Li et al., 2018] 

  • 39.
  • 40.
  • 41. 2,010 10,660 1 ISUCON Alibaba Cloud ecs.sn1ne.large (vCPUx2, Mem 4.0GiB) 3 2 ISUCON9 9560 9100
  • 42. func objective(trial goptuna.Trial) (float64, error) { // Go application goMySQLOpenConns, _ := trial.SuggestInt("mysql_client_open_conns", 1, 64) goMySQLIdleConns, _ := trial.SuggestInt("mysql_client_idle_conns", 1, 64) goMySQLMaxLifetime, _ := trial.SuggestInt("mysql_client_max_lifetime", 1, 128) goHttpIdleConnsPerHost, _ := trial.SuggestInt("http_max_idle_conns_per_host", 1, 4096) goHttpKeepAlive, _ := trial.SuggestInt("http_keep_alive_timeout", 1, 128) campaign, _ := trial.SuggestInt("campaign", 0, 2) // Nginx nginxWorkerProcesses, _ := trial.SuggestInt("nginx_worker_processes", 1, 16) nginxWorkerConns, _ := trial.SuggestInt("nginx_worker_connections", 1, 4096) nginxKeepAliveTimeout, _ := trial.SuggestInt("nginx_keep_alive_timeout", 1, 100) // MySQL innoDBBufferPoolSize, _ := trial.SuggestInt("innodb_buffer_pool_size", 10, 3800) innoDBFlushLogAtTRXCommit, _ := trial.SuggestCategorical(“innodb_flush_log_at_trx_commit", []string{"0", "1", "2"}) innodbFlushMethod, _ := trial.SuggestCategorical("innodb_flush_method", []string{ "fsync", "littlesync", "nosync", "O_DIRECT", "O_DIRECT_NO_FSYNC", }) ... } https://github.com/c-bata/goptuna-isucon9q/blob/master/optimizer/main.go
  • 43. func objective(trial goptuna.Trial) (float64, error) { // Go application goMySQLOpenConns, _ := trial.SuggestInt("mysql_client_open_conns", 1, 64) goMySQLIdleConns, _ := trial.SuggestInt("mysql_client_idle_conns", 1, 64) goMySQLMaxLifetime, _ := trial.SuggestInt("mysql_client_max_lifetime", 1, 128) goHttpIdleConnsPerHost, _ := trial.SuggestInt("http_max_idle_conns_per_host", 1, 4096) goHttpKeepAlive, _ := trial.SuggestInt("http_keep_alive_timeout", 1, 128) campaign, _ := trial.SuggestInt("campaign", 0, 2) // Nginx nginxWorkerProcesses, _ := trial.SuggestInt("nginx_worker_processes", 1, 16) nginxWorkerConns, _ := trial.SuggestInt("nginx_worker_connections", 1, 4096) nginxKeepAliveTimeout, _ := trial.SuggestInt("nginx_keep_alive_timeout", 1, 100) // MySQL innoDBBufferPoolSize, _ := trial.SuggestInt("innodb_buffer_pool_size", 10, 3800) innoDBFlushLogAtTRXCommit, _ := trial.SuggestCategorical(“innodb_flush_log_at_trx_commit", []string{"0", "1", "2"}) innodbFlushMethod, _ := trial.SuggestCategorical("innodb_flush_method", []string{ "fsync", "littlesync", "nosync", "O_DIRECT", "O_DIRECT_NO_FSYNC", }) ... } https://github.com/c-bata/goptuna-isucon9q/blob/master/optimizer/main.go (database/sql).DB
  • 44. func objective(trial goptuna.Trial) (float64, error) { // Go application goMySQLOpenConns, _ := trial.SuggestInt("mysql_client_open_conns", 1, 64) goMySQLIdleConns, _ := trial.SuggestInt("mysql_client_idle_conns", 1, 64) goMySQLMaxLifetime, _ := trial.SuggestInt("mysql_client_max_lifetime", 1, 128) goHttpIdleConnsPerHost, _ := trial.SuggestInt("http_max_idle_conns_per_host", 1, 4096) goHttpKeepAlive, _ := trial.SuggestInt("http_keep_alive_timeout", 1, 128) campaign, _ := trial.SuggestInt("campaign", 0, 2) // Nginx nginxWorkerProcesses, _ := trial.SuggestInt("nginx_worker_processes", 1, 16) nginxWorkerConns, _ := trial.SuggestInt("nginx_worker_connections", 1, 4096) nginxKeepAliveTimeout, _ := trial.SuggestInt("nginx_keep_alive_timeout", 1, 100) // MySQL innoDBBufferPoolSize, _ := trial.SuggestInt("innodb_buffer_pool_size", 10, 3800) innoDBFlushLogAtTRXCommit, _ := trial.SuggestCategorical(“innodb_flush_log_at_trx_commit", []string{"0", "1", "2"}) innodbFlushMethod, _ := trial.SuggestCategorical("innodb_flush_method", []string{ "fsync", "littlesync", "nosync", "O_DIRECT", "O_DIRECT_NO_FSYNC", }) ... } https://github.com/c-bata/goptuna-isucon9q/blob/master/optimizer/main.go API 
 (net/http).Client
  • 45. func objective(trial goptuna.Trial) (float64, error) { // Go application goMySQLOpenConns, _ := trial.SuggestInt("mysql_client_open_conns", 1, 64) goMySQLIdleConns, _ := trial.SuggestInt("mysql_client_idle_conns", 1, 64) goMySQLMaxLifetime, _ := trial.SuggestInt("mysql_client_max_lifetime", 1, 128) goHttpIdleConnsPerHost, _ := trial.SuggestInt("http_max_idle_conns_per_host", 1, 4096) goHttpKeepAlive, _ := trial.SuggestInt("http_keep_alive_timeout", 1, 128) campaign, _ := trial.SuggestInt("campaign", 0, 2) // Nginx nginxWorkerProcesses, _ := trial.SuggestInt("nginx_worker_processes", 1, 16) nginxWorkerConns, _ := trial.SuggestInt("nginx_worker_connections", 1, 4096) nginxKeepAliveTimeout, _ := trial.SuggestInt("nginx_keep_alive_timeout", 1, 100) // MySQL innoDBBufferPoolSize, _ := trial.SuggestInt("innodb_buffer_pool_size", 10, 3800) innoDBFlushLogAtTRXCommit, _ := trial.SuggestCategorical(“innodb_flush_log_at_trx_commit", []string{"0", "1", "2"}) innodbFlushMethod, _ := trial.SuggestCategorical("innodb_flush_method", []string{ "fsync", "littlesync", "nosync", "O_DIRECT", "O_DIRECT_NO_FSYNC", }) ... } https://github.com/c-bata/goptuna-isucon9q/blob/master/optimizer/main.go campaign: 

  • 46. func objective(trial goptuna.Trial) (float64, error) { // Go application goMySQLOpenConns, _ := trial.SuggestInt("mysql_client_open_conns", 1, 64) goMySQLIdleConns, _ := trial.SuggestInt("mysql_client_idle_conns", 1, 64) goMySQLMaxLifetime, _ := trial.SuggestInt("mysql_client_max_lifetime", 1, 128) goHttpIdleConnsPerHost, _ := trial.SuggestInt("http_max_idle_conns_per_host", 1, 4096) goHttpKeepAlive, _ := trial.SuggestInt("http_keep_alive_timeout", 1, 128) campaign, _ := trial.SuggestInt("campaign", 0, 2) // Nginx nginxWorkerProcesses, _ := trial.SuggestInt("nginx_worker_processes", 1, 16) nginxWorkerConns, _ := trial.SuggestInt("nginx_worker_connections", 1, 4096) nginxKeepAliveTimeout, _ := trial.SuggestInt("nginx_keep_alive_timeout", 1, 100) // MySQL innoDBBufferPoolSize, _ := trial.SuggestInt("innodb_buffer_pool_size", 10, 3800) innoDBFlushLogAtTRXCommit, _ := trial.SuggestCategorical(“innodb_flush_log_at_trx_commit", []string{"0", "1", "2"}) innodbFlushMethod, _ := trial.SuggestCategorical("innodb_flush_method", []string{ "fsync", "littlesync", "nosync", "O_DIRECT", "O_DIRECT_NO_FSYNC", }) ... } https://github.com/c-bata/goptuna-isucon9q/blob/master/optimizer/main.go Nginx suggest text/template nginx.conf systemd
  • 47. func objective(trial goptuna.Trial) (float64, error) { // Go application goMySQLOpenConns, _ := trial.SuggestInt("mysql_client_open_conns", 1, 64) goMySQLIdleConns, _ := trial.SuggestInt("mysql_client_idle_conns", 1, 64) goMySQLMaxLifetime, _ := trial.SuggestInt("mysql_client_max_lifetime", 1, 128) goHttpIdleConnsPerHost, _ := trial.SuggestInt("http_max_idle_conns_per_host", 1, 4096) goHttpKeepAlive, _ := trial.SuggestInt("http_keep_alive_timeout", 1, 128) campaign, _ := trial.SuggestInt("campaign", 0, 2) // Nginx nginxWorkerProcesses, _ := trial.SuggestInt("nginx_worker_processes", 1, 16) nginxWorkerConns, _ := trial.SuggestInt("nginx_worker_connections", 1, 4096) nginxKeepAliveTimeout, _ := trial.SuggestInt("nginx_keep_alive_timeout", 1, 100) // MySQL innoDBBufferPoolSize, _ := trial.SuggestInt("innodb_buffer_pool_size", 10, 3800) innoDBFlushLogAtTRXCommit, _ := trial.SuggestCategorical(“innodb_flush_log_at_trx_commit", []string{"0", "1", "2"}) innodbFlushMethod, _ := trial.SuggestCategorical("innodb_flush_method", []string{ "fsync", "littlesync", "nosync", "O_DIRECT", "O_DIRECT_NO_FSYNC", }) ... } https://github.com/c-bata/goptuna-isucon9q/blob/master/optimizer/main.go MySQL Nginx
  • 48.
  • 49. Go MySQL client (net/http).Client Nginx MySQL SetMaxOpen Conns SetMaxIdleC onns SetConnMax Lifetime DialContext. Keepalive MaxIdleConn sPerHost worker_proc esses worker_conn ections keep_alive_ti meout innodb_buffe r_pool_size innodb_flush _log_at_trx_c ommit innodb_flush _method 10660 11160 (+500) 200 37 53 77s 40s 709 11 367 74s 711M 0 fsync Go MySQL client Nginx MySQL SetMaxOpenCo nns SetMaxIdleConn s SetConnMaxLife time worker_connecti ons innodb_buffer_p ool_size innodb_flush_log _at_trx_commit innodb_log_buff er_size innodb_log_file_ size 2010 2310 (+300) 50 23 4 28s 5 210M 0 27M 341M https://github.com/c-bata/goptuna-isucon9q/issues/2 https://github.com/c-bata/goptuna-isucon9q/issues/9
  • 50. Optuna x.264 (by Takeru Ohta a.k.a. @sile)
  • 52. • Goptuna LibFFM [Juan et al., 2016] 
 • Optuna RocsDB by @sile
 • BoTorch/Ax (Facebook) HHVM JIT Compiler 

  • 53.
  • 54. • [Eric et al., 2010] Eric Brochu, Vlad M. Cora, and Nando de Freitas. A tutorial on Bayesian optimization of expensive cost functions, with application to active user modeling and hierarchical reinforcement learning. 2010. arXiv:1012.2599. • [James et al., 2011] James S. Bergstra, Remi Bardenet, Yoshua Bengio, and Balázs Kégl. Algorithms for hyper- parameter optimization. In Advances in Neural Information Processing Systems 25. 2011. • [Akiba at el., 2019] Takuya Akiba, Shotaro Sano, Toshihiko Yanase, Takeru Ohta, Masanori Koyama. 2019. Optuna: A Next-generation Hyperparameter Optimization Framework. In The 25th ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD ’19), August 4–8, 2019. • [Jamieson and Talwalkar, 2016] K. Jamieson and A. Talwalkar. Non-stochastic best arm identification and hyperparameter optimization. In AISTATS, 2016. • [Li et al., 2018] Liam Li, Kevin Jamieson, Afshin Rostamizadeh, Ekaterina Gonina, Moritz Hardt, Benjamin Recht, and Ameet Talwalkar. Massively parallel hyperparameter tuning. arXiv preprint arXiv:1810.05934, 2018. • [Eggensperger et al., 2013] Eggensperger, K., Feurer, M., Hutter, F., Bergstra, J., Snoek, J., Hoos, H., and Leyton-Brown, K.: Towards an Empirical Foundation for Assessing Bayesian Optimization of Hyperparameters, in NeurIPS workshop on Bayesian Optimization in Theory and Practice (2013). • [Juan et al., 2016] Yu-Chin Juan, Yong Zhuang, Wei-Sheng Chin, and Chih-Jen Lin. Field-aware factorization machines for CTR prediction. In RecSys, pages 43–50, 2016. References
  • 56.