SPOT Examples¶
Simple spotpython run¶
import numpy as np
from spotpython.spot import spot
from spotpython.fun.objectivefunctions import analytical
from spotpython.utils.init import fun_control_init, design_control_init, surrogate_control_init
fun = analytical().fun_branin
fun_control = fun_control_init(lower = np.array([-5, 0]),
upper = np.array([10, 15]),
fun_evals=20)
design_control = design_control_init(init_size=10)
surrogate_control = surrogate_control_init(n_theta=2)
S = spot.Spot(fun=fun, fun_control=fun_control, design_control=design_control)
S.run()
spotpython tuning: 3.146824136952164 [######----] 55.00%
spotpython tuning: 3.146824136952164 [######----] 60.00%
spotpython tuning: 3.146824136952164 [######----] 65.00%
spotpython tuning: 3.146824136952164 [#######---] 70.00%
spotpython tuning: 1.1487233101571483 [########--] 75.00%
spotpython tuning: 1.0236891516766402 [########--] 80.00%
spotpython tuning: 0.41994270072214057 [########--] 85.00%
spotpython tuning: 0.40193544341108023 [#########-] 90.00%
spotpython tuning: 0.3991519598268951 [##########] 95.00%
spotpython tuning: 0.3991519598268951 [##########] 100.00% Done...
S.print_results()
min y: 0.3991519598268951
x0: 3.1546575195040987
x1: 2.285931113926263
S.plot_progress(log_y=True)
S.surrogate.plot()
Further Examples¶
Examples can be found in the Hyperparameter Tuning Cookbook, e.g., Documentation of the Sequential Parameter Optimization.