SlideShare a Scribd company logo
Jakub Czakon
●
●
○
○
●
scoredata
https://bbabenko.github.io/convolutional-learnings/
scoredata
●
●
●
●
●
●
●
●
●
●
●
●
●
●
Hyperparameter optimization landscape
Hyperparameter optimization landscape
Hyperparameter optimization landscape
●
○
○
○
●
SPACE = [skopt.space.Real(0.01, 0.5, name='learning_rate', prior='log-uniform'),
skopt.space.Integer(1, 30, name='max_depth'),
skopt.space.Integer(2, 100, name='num_leaves'),
skopt.space.Integer(10, 1000, name='min_data_in_leaf'),
skopt.space.Real(0.1, 1.0, name='feature_fraction', prior='uniform'),
skopt.space.Real(0.1, 1.0, name='subsample', prior='uniform'),
]
●
●
def objective(**params):
return -1.0 * train_evaluate(X, y, **params)
@skopt.utils.use_named_args(SPACE)
def objective(**params):
return -1.0 * train_evaluate(X, y, **params)
●
○
○
○
●
results = skopt.forest_minimize(objective, SPACE,
callback=[monitor],
n_calls=100,
n_random_starts=10,
base_estimator='ET',
acq_func='LCB',
xi=0.02,
kappa=1.96)
def monitor(res):
neptune.send_metric('run_score', res.func_vals[-1])
●
●
○
○
●
○
○
●
●
●
●
○
○
○
●
skopt.plots.plot_convergence(results)
skopt.plots.plot_convergence(results_list)
skopt.plots.plot_evaluations(results)
skopt.plots.plot_evaluations(results)
skopt.plots.plot_evaluations(results)
skopt.plots.plot_objective(results)
● cannot distribute it
● n_jobs
● 1 machine it is fast
●
●
● skopt
Hyperparameter optimization landscape
●
●
●
●
●
●
●
Hyperparameter optimization landscape
Hyperparameter optimization landscape
def objective(trial):
params = OrderedDict([
('learning_rate',trial.suggest_loguniform('learning_rate', 0.01, 0.5)),
('max_depth',trial.suggest_int('max_depth', 1, 30)),
('num_leaves',trial.suggest_int('num_leaves', 2, 100)),
('min_data_in_leaf',trial.suggest_int('min_data_in_leaf', 10, 1000)),
('feature_fraction',trial.suggest_uniform('feature_fraction', 0.1, 1.0)),
('subsample',trial.suggest_uniform('subsample', 0.1, 1.0))])
score = -1.0 * train_evaluate(X, y, params)
return score
●
○
○
○
●
def objective(trial):
classifier_name = trial.suggest_categorical('classifier', ['SVC', 'RandomForest'])
if classifier_name == 'SVC':
svc_c = trial.suggest_loguniform('svc_c', 1e-10, 1e10)
classifier_obj = sklearn.svm.SVC(C=svc_c)
else:
rf_max_depth = int(trial.suggest_loguniform('rf_max_depth', 2, 32))
classifier_obj = sklearn.ensemble.RandomForestClassifier(max_depth=rf_max_depth)
…
●
●
●
●
study = optuna.create_study()
study.optimize(objective, n_trials=100])
results = study.trails_dataframe()
from optuna.integration import LightGBMPruningCallback
def objective(trial):
params = OrderedDict([
('max_depth',trial.suggest_int('max_depth', 1, 30)),
('num_leaves',trial.suggest_int('num_leaves', 2, 100))])
pruning_callback = LightGBMPruningCallback(trial, 'auc')
score = -1.0 * train_evaluate_with_pruning(X, y, params, pruning_callback)
return score
def train_evaluate_with_pruning(X, y, params, callback):
...
model = lgb.train(params, train_data, ... , callbacks = [pruning_callback])
return model.best_score['valid']['auc']
def monitor(score):
neptune.send_metric('run_score', score)
def objective(trial):
params = OrderedDict([
('max_depth',trial.suggest_int('max_depth', 1, 30)),
('num_leaves',trial.suggest_int('num_leaves', 2, 100))])
score = -1.0 * train_evaluate(X, y, params)
monitor(score)
return score
●
●
●
Hyperparameter optimization landscape
● Can be distributed
● Has pruning
study.optimize(objective, n_trials=100, n_jobs=5)
…
study = optuna.Study(study_name='distributed-search', storage='sqlite:///example.db')
study.optimize(objective, n_trials=100)
...
$ optuna create-study --study-name "distributed-search" --storage "sqlite:///example.db"
$ python optuna_search.py
$ python optuna_search.py
terminal 1
terminal 2
terminal 3
optuna_search.py
●
●
● optuna
Hyperparameter optimization landscape
●
●
●
●
●
●
●
●
●
●
●
●
●
●
Hyperparameter optimization landscape
Hyperparameter optimization landscape
●
●
○
○
●
Hyperparameter optimization landscape
Hyperparameter optimization landscape
●
○
○
●
import hpbandster.core.nameserver as hpns
NS = hpns.NameServer(run_id=RUN_ID, host=HOST, port=PORT, working_directory=WORKING_DIRECTORY)
ns_host, ns_port = NS.start()
from hpbandster.core.worker import Worker
class TrainEvalWorker(Worker):
...
def compute(self, config, budget, working_directory, *args, **kwargs):
loss = -1.0 * train_evaluate(self.X, self.y, params)
return ({'loss': loss,
'info': { 'auxiliary_stuff': 'worked'
}
})
●
○
○
○
●
class TrainEvalWorker(Worker):
...
@staticmethod
def get_configspace():
cs = CS.ConfigurationSpace()
learning_rate = CSH.UniformFloatHyperparameter('learning_rate',
lower=0.01, upper=0.5, default_value=0.01, log=True)
subsample = CSH.UniformFloatHyperparameter('subsample',
lower=0.1, upper=1.0, default_value=0.5, log=False)
cs.add_hyperparameters([learning_rate, subsample])
return cs
worker = TrainEvalWorker(run_id=RUN_ID, nameserver=ns_host, nameserver_port=ns_port)
worker.run(background=True)
from hpbandster.optimizers import BOHB
optim = BOHB(configspace = worker.get_configspace(),
run_id = RUN_ID,
nameserver=ns_host,
nameserver_port=ns_port,
result_logger=NeptuneLogger(),
eta=3, min_budget=0.1, max_budget=1,
num_samples=64, top_n_percent=15,
min_bandwidth=1e-3, bandwidth_factor=3)
study = optim.run(n_iterations=100)
class NeptuneLogger:
def new_config(self, *args, **kwargs):
pass
def __call__(self, job):
neptune.send_metric('run_score', job.result['loss'])
neptune.send_text('run_parameters', str(job.kwargs['config']))
●
●
●
●
○
○
○
○
○
●
all_runs = results.get_all_runs()
hpvis.losses_over_time(all_runs);
all_runs = results.get_all_runs()
hpvis.concurrent_runs_over_time(all_runs);
all_runs = results.get_all_runs()
hpvis.finished_runs_over_time(all_runs);
hpvis.correlation_across_budgets(results);
Hyperparameter optimization landscape
all_runs = results.get_all_runs()
id2conf = results.get_id2config_mapping()
hpvis.performance_histogram_model_vs_random(all_runs, id2conf);
Hyperparameter optimization landscape
● Can be distributed
workers=[]
for i in range(N_WORKERS):
w = TrainEvalWorker(run_id=RUN_ID, id=isleep_interval = 0.5,
nameserver=ns_host, nameserver_port=ns_port)
w.run(background=True)
workers.append(w)
optim = BOHB(configspace = TrainEvalWorker.get_configspace(),
run_id = RUN_ID,
nameserver=ns_host,
nameserver_port=ns_port)
study = optim.run(n_iterations=100, min_n_workers=N_WORKERS)
workers=[]
for i in range(N_WORKERS):
w = TrainEvalWorker(run_id=RUN_ID, id=isleep_interval = 0.5,
nameserver=ns_host, nameserver_port=ns_port)
w.run(background=False)
exit(0)
optim = BOHB(configspace = TrainEvalWorker.get_configspace(),
run_id = RUN_ID,
nameserver=ns_host,
nameserver_port=ns_port)
study = optim.run(n_iterations=100, min_n_workers=N_WORKERS)
Hyperparameter optimization landscape
●
●
● hpbandster
Hyperparameter optimization landscape
●
●
●
●
●
●
Hyperparameter optimization landscape
Scikit-Optimize Optuna HpBandSter Hyperopt
API/ease of use Great Great Difficult Good
Documentation Great Great Ok(ish) Bad
Speed/Parallelization Fast if
sequential/None
Great Good Ok
Visualizations Amazing None Very lib specific Some
*Experimental results 0.8566 (100) 0.8419 (100)
0.8597 (10000)
0.8629 (100) 0.8420 (100)
Hyperparameter optimization landscape
import neptunecontrib.hpo.utils as hpo_utils
results = hpo_utils.optuna2skopt(study)
● Scikit-Optimize
● HpBandSter
● Optuna
jakub@neptune.ml
@NeptuneML
https://medium.com/@jakub.czakon
https://twitter.com/neptuneml

More Related Content

What's hot (20)

PDF
_Function Builders in Swift #love_swift
Tomohiro Kumagai
 
PPT
Gearmam, from the_worker's_perspective copy
Brian Aker
 
PDF
Gearman, from the worker's perspective
Brian Aker
 
PPTX
High performance GPU computing with Ruby RubyConf 2017
Prasun Anand
 
PDF
cluster(python)
Noriyuki Kojima
 
PDF
Cycle.js: Functional and Reactive
Eugene Zharkov
 
PDF
Programmation fonctionnelle en JavaScript
Loïc Knuchel
 
PDF
Elm: give it a try
Eugene Zharkov
 
PDF
Rubyconfindia2018 - GPU accelerated libraries for Ruby
Prasun Anand
 
PDF
TensorFlow Tutorial
NamHyuk Ahn
 
PDF
ECMAScript 6 major changes
hayato
 
PDF
Coq setoid 20110129
tmiya
 
PDF
Corona sdk
Dom Dominic Toretto
 
PDF
20180721 code defragment
Chiwon Song
 
PDF
20181020 advanced higher-order function
Chiwon Song
 
PDF
python高级内存管理
rfyiamcool
 
PDF
Groovy collection api
trygvea
 
PDF
20180310 functional programming
Chiwon Song
 
PDF
Postgres can do THAT?
alexbrasetvik
 
PPTX
Data Types and Processing in ES6
m0bz
 
_Function Builders in Swift #love_swift
Tomohiro Kumagai
 
Gearmam, from the_worker's_perspective copy
Brian Aker
 
Gearman, from the worker's perspective
Brian Aker
 
High performance GPU computing with Ruby RubyConf 2017
Prasun Anand
 
cluster(python)
Noriyuki Kojima
 
Cycle.js: Functional and Reactive
Eugene Zharkov
 
Programmation fonctionnelle en JavaScript
Loïc Knuchel
 
Elm: give it a try
Eugene Zharkov
 
Rubyconfindia2018 - GPU accelerated libraries for Ruby
Prasun Anand
 
TensorFlow Tutorial
NamHyuk Ahn
 
ECMAScript 6 major changes
hayato
 
Coq setoid 20110129
tmiya
 
20180721 code defragment
Chiwon Song
 
20181020 advanced higher-order function
Chiwon Song
 
python高级内存管理
rfyiamcool
 
Groovy collection api
trygvea
 
20180310 functional programming
Chiwon Song
 
Postgres can do THAT?
alexbrasetvik
 
Data Types and Processing in ES6
m0bz
 

Similar to Hyperparameter optimization landscape (20)

PDF
Dss2019 hyperparameter optimization landscape
Jakub Czakon
 
PDF
Hyperparameter optimization landscape Berlin ML Group meetup 8/2019
Jakub Czakon
 
PPTX
Image classification using cnn
Debarko De
 
PDF
Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)
Thomas Fan
 
PDF
작은 스타트업에서 머신러닝 맛보기
성민 이
 
PPTX
Introduction to Neural Networks and Deep Learning from Scratch
Ahmed BESBES
 
PDF
Intelligent System Optimizations
Martin Zapletal
 
DOCX
機会学習レポート
taishimotoda
 
PDF
Assignment 6.2a.pdf
dash41
 
PPTX
Cubesat challenge considerations deep dive
clintonbeye
 
PDF
딥러닝, 야 너도 할 수 있어(feat. PyTorch)
NHN FORWARD
 
DOCX
LSTM Framework For Univariate Time series
bilyamine1
 
PDF
딥러닝 기초 - XOR 문제와 딥뉴럴넷(Basic of DL - XOR problem and DNN)
Hansol Kang
 
PDF
NTU ML TENSORFLOW
Mark Chang
 
PDF
Tensor flow description of ML Lab. document
jeongok1
 
PPTX
ML_Lab_CSAI_2F - Jupyter Notebook (1).pptx
anjali2upadhya
 
PDF
Machine Learning with Python: Distributed Training and Data Resources on Blue...
inside-BigData.com
 
PDF
A Tale of Three Deep Learning Frameworks: TensorFlow, Keras, & PyTorch with B...
Databricks
 
PDF
Uber's Journey in Distributed Deep Learning
inside-BigData.com
 
PDF
ML基本からResNetまで
Institute of Agricultural Machinery, NARO
 
Dss2019 hyperparameter optimization landscape
Jakub Czakon
 
Hyperparameter optimization landscape Berlin ML Group meetup 8/2019
Jakub Czakon
 
Image classification using cnn
Debarko De
 
Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)
Thomas Fan
 
작은 스타트업에서 머신러닝 맛보기
성민 이
 
Introduction to Neural Networks and Deep Learning from Scratch
Ahmed BESBES
 
Intelligent System Optimizations
Martin Zapletal
 
機会学習レポート
taishimotoda
 
Assignment 6.2a.pdf
dash41
 
Cubesat challenge considerations deep dive
clintonbeye
 
딥러닝, 야 너도 할 수 있어(feat. PyTorch)
NHN FORWARD
 
LSTM Framework For Univariate Time series
bilyamine1
 
딥러닝 기초 - XOR 문제와 딥뉴럴넷(Basic of DL - XOR problem and DNN)
Hansol Kang
 
NTU ML TENSORFLOW
Mark Chang
 
Tensor flow description of ML Lab. document
jeongok1
 
ML_Lab_CSAI_2F - Jupyter Notebook (1).pptx
anjali2upadhya
 
Machine Learning with Python: Distributed Training and Data Resources on Blue...
inside-BigData.com
 
A Tale of Three Deep Learning Frameworks: TensorFlow, Keras, & PyTorch with B...
Databricks
 
Uber's Journey in Distributed Deep Learning
inside-BigData.com
 
ML基本からResNetまで
Institute of Agricultural Machinery, NARO
 
Ad

Recently uploaded (20)

PPTX
Presentation (1) (1).pptx k8hhfftuiiigff
karthikjagath2005
 
PDF
McKinsey - Global Energy Perspective 2023_11.pdf
niyudha
 
PDF
apidays Munich 2025 - Making Sense of AI-Ready APIs in a Buzzword World, Andr...
apidays
 
PPTX
Solution+Architecture+Review+-+Sample.pptx
manuvratsingh1
 
PPTX
Data Security Breach: Immediate Action Plan
varmabhuvan266
 
PDF
apidays Munich 2025 - Developer Portals, API Catalogs, and Marketplaces, Miri...
apidays
 
PDF
717629748-Databricks-Certified-Data-Engineer-Professional-Dumps-by-Ball-21-03...
pedelli41
 
PPTX
White Blue Simple Modern Enhancing Sales Strategy Presentation_20250724_21093...
RamNeymarjr
 
PPTX
Probability systematic sampling methods.pptx
PrakashRajput19
 
PPTX
7 Easy Ways to Improve Clarity in Your BI Reports
sophiegracewriter
 
PDF
Classifcation using Machine Learning and deep learning
bhaveshagrawal35
 
PPTX
M1-T1.pptxM1-T1.pptxM1-T1.pptxM1-T1.pptx
teodoroferiarevanojr
 
PDF
blockchain123456789012345678901234567890
tanvikhunt1003
 
PDF
202501214233242351219 QASS Session 2.pdf
lauramejiamillan
 
PDF
SUMMER INTERNSHIP REPORT[1] (AutoRecovered) (6) (1).pdf
pandeydiksha814
 
PDF
D9110.pdfdsfvsdfvsdfvsdfvfvfsvfsvffsdfvsdfvsd
minhn6673
 
PPTX
Introduction-to-Python-Programming-Language (1).pptx
dhyeysapariya
 
PPTX
short term internship project on Data visualization
JMJCollegeComputerde
 
PPTX
Future_of_AI_Presentation for everyone.pptx
boranamanju07
 
PPT
Real Life Application of Set theory, Relations and Functions
manavparmar205
 
Presentation (1) (1).pptx k8hhfftuiiigff
karthikjagath2005
 
McKinsey - Global Energy Perspective 2023_11.pdf
niyudha
 
apidays Munich 2025 - Making Sense of AI-Ready APIs in a Buzzword World, Andr...
apidays
 
Solution+Architecture+Review+-+Sample.pptx
manuvratsingh1
 
Data Security Breach: Immediate Action Plan
varmabhuvan266
 
apidays Munich 2025 - Developer Portals, API Catalogs, and Marketplaces, Miri...
apidays
 
717629748-Databricks-Certified-Data-Engineer-Professional-Dumps-by-Ball-21-03...
pedelli41
 
White Blue Simple Modern Enhancing Sales Strategy Presentation_20250724_21093...
RamNeymarjr
 
Probability systematic sampling methods.pptx
PrakashRajput19
 
7 Easy Ways to Improve Clarity in Your BI Reports
sophiegracewriter
 
Classifcation using Machine Learning and deep learning
bhaveshagrawal35
 
M1-T1.pptxM1-T1.pptxM1-T1.pptxM1-T1.pptx
teodoroferiarevanojr
 
blockchain123456789012345678901234567890
tanvikhunt1003
 
202501214233242351219 QASS Session 2.pdf
lauramejiamillan
 
SUMMER INTERNSHIP REPORT[1] (AutoRecovered) (6) (1).pdf
pandeydiksha814
 
D9110.pdfdsfvsdfvsdfvsdfvfvfsvfsvffsdfvsdfvsd
minhn6673
 
Introduction-to-Python-Programming-Language (1).pptx
dhyeysapariya
 
short term internship project on Data visualization
JMJCollegeComputerde
 
Future_of_AI_Presentation for everyone.pptx
boranamanju07
 
Real Life Application of Set theory, Relations and Functions
manavparmar205
 
Ad

Hyperparameter optimization landscape