import warnings
warnings.filterwarnings("ignore")
import json
import numpy as np
from spotpython.fun.objectivefunctions import Analytical
from spotpython.spot import Spot
from spotpython.utils.init import fun_control_init, design_control_init, surrogate_control_init
from spotpython.plot.contour import plotModel25 Benchmarking SPOT Kriging with Matern Kernel on 6D Rosenbrock Function and 10D Michalewicz Function
These test functions were used during the Dagstuhl Seminar 25451 Bayesian Optimisation (Nov 02 – Nov 07, 2025), see here.
25.1 SPOT Kriging in 6 Dimensions: Rosenbrock Function
This notebook demonstrates how to use the Spot class from spotpython for Kriging surrogates on the 6-dimensional Rosenbrock function. We use a maximum of 100 function evaluations.
To visualize the optimization process, you can start tensorboard with:
tensorboard --logdir="runs/"25.1.1 Define the 6D Rosenbrock Function
dim = 6
lower = np.full(dim, -2)
upper = np.full(dim, 2)
fun = Analytical().fun_rosenbrock
fun_evals = 10025.1.2 Set up SPOT Controls
init_size = dim
seed = 321
max_surrogate_points = fun_evals
max_time = 6025.1.3 Compile the necessary imports
fun_control = fun_control_init(
lower=lower,
upper=upper,
fun_evals=fun_evals,
seed=seed,
show_progress=True,
TENSORBOARD_CLEAN=True,
tensorboard_log=True,
max_time=max_time
)
design_control = design_control_init(init_size=init_size)
surrogate_control_exact = surrogate_control_init(max_surrogate_points=max_surrogate_points)Moving TENSORBOARD_PATH: runs/ to TENSORBOARD_PATH_OLD: runs_OLD/runs_2025_11_06_17_24_14_0
Created spot_tensorboard_path: runs/spot_logs/000_maans08_2025-11-06_17-24-14 for SummaryWriter()
25.1.4 Sklearn Gaussian Process Regressor as Surrogate
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import Matern, ConstantKernel
# Used a Matern kernel instead of the standard spotpython RBF kernel
kernel = ConstantKernel(1.0, (1e-2, 1e12)) * Matern(length_scale=1.0, length_scale_bounds=(1e-4, 1e2), nu=2.5)
S_GP = GaussianProcessRegressor(kernel=kernel, n_restarts_optimizer=100)
S_rosen = Spot(
fun=fun,
fun_control=fun_control,
design_control=design_control,
surrogate_control=surrogate_control_exact,
surrogate=S_GP,
)
S_rosen.run()spotpython tuning: 321.8341532536645 [#---------] 7.00%. Success rate: 0.00%
spotpython tuning: 321.8341532536645 [#---------] 8.00%. Success rate: 0.00%
spotpython tuning: 321.8341532536645 [#---------] 9.00%. Success rate: 0.00%
spotpython tuning: 179.35533825140524 [#---------] 10.00%. Success rate: 25.00%
spotpython tuning: 147.21603987143845 [#---------] 11.00%. Success rate: 40.00%
spotpython tuning: 126.87473490284455 [#---------] 12.00%. Success rate: 50.00%
spotpython tuning: 106.90954193892807 [#---------] 13.00%. Success rate: 57.14%
spotpython tuning: 77.69348083271842 [#---------] 14.00%. Success rate: 62.50%
spotpython tuning: 67.649153095507 [##--------] 15.00%. Success rate: 66.67%
spotpython tuning: 67.649153095507 [##--------] 16.00%. Success rate: 60.00%
spotpython tuning: 66.9626271912866 [##--------] 17.00%. Success rate: 63.64%
spotpython tuning: 66.88621978082725 [##--------] 18.00%. Success rate: 66.67%
spotpython tuning: 63.391023128695885 [##--------] 19.00%. Success rate: 69.23%
spotpython tuning: 53.85636814729686 [##--------] 20.00%. Success rate: 71.43%
spotpython tuning: 53.49391616057949 [##--------] 21.00%. Success rate: 73.33%
spotpython tuning: 52.75720177494789 [##--------] 22.00%. Success rate: 75.00%
spotpython tuning: 51.70260384929565 [##--------] 23.00%. Success rate: 76.47%
spotpython tuning: 48.25120609312787 [##--------] 24.00%. Success rate: 77.78%
spotpython tuning: 48.25120609312787 [##--------] 25.00%. Success rate: 73.68%
spotpython tuning: 48.25120609312787 [###-------] 26.00%. Success rate: 70.00%
spotpython tuning: 46.3246537911565 [###-------] 27.00%. Success rate: 71.43%
spotpython tuning: 42.76481779596959 [###-------] 28.00%. Success rate: 72.73%
spotpython tuning: 42.76481779596959 [###-------] 29.00%. Success rate: 69.57%
spotpython tuning: 41.526528813290554 [###-------] 30.00%. Success rate: 70.83%
spotpython tuning: 40.952097655681094 [###-------] 31.00%. Success rate: 72.00%
spotpython tuning: 40.934901028622136 [###-------] 32.00%. Success rate: 73.08%
spotpython tuning: 40.22233309635489 [###-------] 33.00%. Success rate: 74.07%
spotpython tuning: 38.703235236651906 [###-------] 34.00%. Success rate: 75.00%
spotpython tuning: 38.703235236651906 [####------] 35.00%. Success rate: 72.41%
spotpython tuning: 37.51684366297374 [####------] 36.00%. Success rate: 73.33%
spotpython tuning: 35.04023839011781 [####------] 37.00%. Success rate: 74.19%
spotpython tuning: 34.782728458149876 [####------] 38.00%. Success rate: 75.00%
spotpython tuning: 33.715641444530284 [####------] 39.00%. Success rate: 75.76%
spotpython tuning: 30.33475554268759 [####------] 40.00%. Success rate: 76.47%
spotpython tuning: 27.48465910515007 [####------] 41.00%. Success rate: 77.14%
spotpython tuning: 22.397004844008666 [####------] 42.00%. Success rate: 77.78%
spotpython tuning: 21.53531596617666 [####------] 43.00%. Success rate: 78.38%
spotpython tuning: 20.59772434535631 [####------] 44.00%. Success rate: 78.95%
spotpython tuning: 18.893987455200055 [####------] 45.00%. Success rate: 79.49%
spotpython tuning: 18.893987455200055 [#####-----] 46.00%. Success rate: 77.50%
spotpython tuning: 16.082897103681365 [#####-----] 47.00%. Success rate: 78.05%
spotpython tuning: 16.082897103681365 [#####-----] 48.00%. Success rate: 76.19%
spotpython tuning: 12.063961157514088 [#####-----] 49.00%. Success rate: 76.74%
spotpython tuning: 11.436163581417214 [#####-----] 50.00%. Success rate: 77.27%
spotpython tuning: 10.976555797014804 [#####-----] 51.00%. Success rate: 77.78%
spotpython tuning: 10.742943648053409 [#####-----] 52.00%. Success rate: 78.26%
spotpython tuning: 10.742943648053409 [#####-----] 53.00%. Success rate: 76.60%
spotpython tuning: 10.212951579441011 [#####-----] 54.00%. Success rate: 77.08%
spotpython tuning: 10.212951579441011 [######----] 55.00%. Success rate: 75.51%
spotpython tuning: 8.473906221332905 [######----] 56.00%. Success rate: 76.00%
spotpython tuning: 8.143810000645447 [######----] 57.00%. Success rate: 76.47%
spotpython tuning: 7.609712089857253 [######----] 58.00%. Success rate: 76.92%
spotpython tuning: 7.5676169925334165 [######----] 59.00%. Success rate: 77.36%
spotpython tuning: 7.11880968405016 [######----] 60.00%. Success rate: 77.78%
spotpython tuning: 5.687389513402996 [######----] 61.00%. Success rate: 78.18%
spotpython tuning: 5.620991003333602 [######----] 62.00%. Success rate: 78.57%
spotpython tuning: 5.620991003333602 [######----] 63.00%. Success rate: 77.19%
spotpython tuning: 5.423892827249712 [######----] 64.00%. Success rate: 77.59%
spotpython tuning: 5.423892827249712 [######----] 65.00%. Success rate: 76.27%
spotpython tuning: 5.237130892528292 [#######---] 66.00%. Success rate: 76.67%
spotpython tuning: 5.036969187079004 [#######---] 67.00%. Success rate: 77.05%
spotpython tuning: 4.8796577660348905 [#######---] 68.00%. Success rate: 77.42%
spotpython tuning: 4.719093745018782 [#######---] 69.00%. Success rate: 77.78%
spotpython tuning: 4.526285961824466 [#######---] 70.00%. Success rate: 78.12%
spotpython tuning: 4.438299987874697 [#######---] 71.00%. Success rate: 78.46%
spotpython tuning: 4.368066999210535 [#######---] 72.00%. Success rate: 78.79%
spotpython tuning: 4.365926850257534 [#######---] 73.00%. Success rate: 79.10%
spotpython tuning: 4.362137718825476 [#######---] 74.00%. Success rate: 79.41%
spotpython tuning: 4.362137718825476 [########--] 75.00%. Success rate: 78.26%
spotpython tuning: 4.342651220906797 [########--] 76.00%. Success rate: 78.57%
spotpython tuning: 4.256513182100539 [########--] 77.00%. Success rate: 78.87%
spotpython tuning: 4.25219874860585 [########--] 78.00%. Success rate: 79.17%
spotpython tuning: 4.25219874860585 [########--] 79.00%. Success rate: 78.08%
spotpython tuning: 4.232311644611174 [########--] 80.00%. Success rate: 78.38%
spotpython tuning: 4.203199573250576 [########--] 81.00%. Success rate: 78.67%
spotpython tuning: 4.154659651829351 [########--] 82.00%. Success rate: 78.95%
spotpython tuning: 4.042012833652297 [########--] 83.00%. Success rate: 79.22%
spotpython tuning: 4.028328913111308 [########--] 84.00%. Success rate: 79.49%
spotpython tuning: 3.9867050391555208 [########--] 85.00%. Success rate: 79.75%
spotpython tuning: 3.9664322383674593 [#########-] 86.00%. Success rate: 80.00%
spotpython tuning: 3.9617029865786804 [#########-] 87.00%. Success rate: 80.25%
spotpython tuning: 3.944859434404279 [#########-] 88.00%. Success rate: 80.49%
spotpython tuning: 3.9082082139352954 [#########-] 89.00%. Success rate: 80.72%
spotpython tuning: 3.901010507879793 [#########-] 90.00%. Success rate: 80.95%
spotpython tuning: 3.8774917098296067 [#########-] 91.00%. Success rate: 81.18%
spotpython tuning: 3.8361203936196566 [#########-] 92.00%. Success rate: 81.40%
spotpython tuning: 3.728933268434127 [#########-] 93.00%. Success rate: 81.61%
spotpython tuning: 3.6944168818989636 [#########-] 94.00%. Success rate: 81.82%
spotpython tuning: 3.6944168818989636 [##########] 95.00%. Success rate: 80.90%
spotpython tuning: 3.6700136995467343 [##########] 96.00%. Success rate: 81.11%
spotpython tuning: 3.6700136995467343 [##########] 97.00%. Success rate: 80.22%
spotpython tuning: 3.525062651400326 [##########] 98.00%. Success rate: 80.43%
spotpython tuning: 3.525062651400326 [##########] 99.00%. Success rate: 79.57%
spotpython tuning: 3.525062651400326 [##########] 100.00%. Success rate: 78.72% Done...
Experiment saved to 000_res.pkl
<spotpython.spot.spot.Spot at 0x13187ecf0>
S_rosen.plot_progress(log_y=True, title="Exact sklearn Kriging Progress with y")
print(f"[6D] Exact Kriging y: min y = {S_rosen.min_y:.4f} at x = {S_rosen.min_X}")[6D] Exact Kriging y: min y = 3.5251 at x = [ 0.58472142 0.34079126 0.09826374 0.00327421 0.03339366 -0.016073 ]
Plot of the surrogate model in the first two dimensions:
model = S_rosen.surrogate
fig, axes = plotModel(
model=model,
lower=lower,
upper=upper,
i=0,
j=1,
n_grid=100,
contour_levels=20,
)
25.1.5 Evaluation of 30 repeats with Kriging and Matern kernel
Since 30 repeats were performed and stored in spot_rosen.json, we can now evaluate the results:
# Load results from spot_rosen.json
with open("spot_rosen.json", "r") as f:
data = json.load(f)
# Extract all "evaluations" values
evals = [
iteration["sampled_locations"][0]["evaluations"]
for iteration in data["search_iterations"]
]
# Compute mean and standard deviation
mean_eval = np.mean(evals)
std_eval = np.std(evals)
print(f"Mean of evaluations: {mean_eval:.6f}")
print(f"Standard deviation of evaluations: {std_eval:.6f}")Mean of evaluations: 3.015181
Standard deviation of evaluations: 1.901997
25.2 SPOT Kriging in 10 Dimensions: Exact (Michalewicz Function)
This notebook demonstrates how to use the Spot class from spotpython for Kriging surrogates on the 10-dimensional Michalewicz function. We use a maximum of 300 function evaluations.
25.2.1 Define the 10D Michalewicz Function
dim = 10
lower = np.full(dim, 0)
upper = np.full(dim, np.pi)
fun = Analytical().fun_michalewicz
fun_evals = 300
max_time = 6025.2.2 Set up SPOT Controls
init_size = dim
seed = 321
max_surrogate_points = fun_evals25.2.3 Compile the necessary imports
fun_control = fun_control_init(
lower=lower,
upper=upper,
fun_evals=fun_evals,
seed=seed,
show_progress=True,
TENSORBOARD_CLEAN=True,
tensorboard_log=True,
max_time=max_time
)
design_control = design_control_init(init_size=init_size)
surrogate_control_exact = surrogate_control_init(max_surrogate_points=max_surrogate_points)Moving TENSORBOARD_PATH: runs/ to TENSORBOARD_PATH_OLD: runs_OLD/runs_2025_11_06_17_25_41_0
Created spot_tensorboard_path: runs/spot_logs/000_maans08_2025-11-06_17-25-41 for SummaryWriter()
25.2.4 Sklearn Gaussian Process Regressor as Surrogate
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import Matern, ConstantKernel
# Used a Matern kernel instead of the standard spotpython RBF kernel
kernel = ConstantKernel(1.0, (1e-2, 1e12)) * Matern(length_scale=1.0, length_scale_bounds=(1e-4, 1e2), nu=2.5)
S_GP = GaussianProcessRegressor(kernel=kernel, n_restarts_optimizer=100)
S_micha = Spot(
fun=fun,
fun_control=fun_control,
design_control=design_control,
surrogate_control=surrogate_control_exact,
surrogate=S_GP,
)
S_micha.run()spotpython tuning: -1.909128962635467 [----------] 3.67%. Success rate: 0.00%
spotpython tuning: -2.779427569120735 [----------] 4.00%. Success rate: 50.00%
spotpython tuning: -2.779427569120735 [----------] 4.33%. Success rate: 33.33%
spotpython tuning: -2.779427569120735 [----------] 4.67%. Success rate: 25.00%
spotpython tuning: -3.2119020715657354 [----------] 5.00%. Success rate: 40.00%
spotpython tuning: -3.2119020715657354 [#---------] 5.33%. Success rate: 33.33%
spotpython tuning: -3.2119020715657354 [#---------] 5.67%. Success rate: 28.57%
spotpython tuning: -3.3391515283456545 [#---------] 6.00%. Success rate: 37.50%
spotpython tuning: -3.3391515283456545 [#---------] 6.33%. Success rate: 33.33%
spotpython tuning: -3.411784183887579 [#---------] 6.67%. Success rate: 40.00%
spotpython tuning: -3.4470012631092235 [#---------] 7.00%. Success rate: 45.45%
spotpython tuning: -3.452659777394402 [#---------] 7.33%. Success rate: 50.00%
spotpython tuning: -3.5241383868272567 [#---------] 7.67%. Success rate: 53.85%
spotpython tuning: -3.5241383868272567 [#---------] 8.00%. Success rate: 50.00%
spotpython tuning: -3.5241383868272567 [#---------] 8.33%. Success rate: 46.67%
spotpython tuning: -3.5241383868272567 [#---------] 8.67%. Success rate: 43.75%
spotpython tuning: -3.539668108921282 [#---------] 9.00%. Success rate: 47.06%
spotpython tuning: -3.539668108921282 [#---------] 9.33%. Success rate: 44.44%
spotpython tuning: -3.592378171035613 [#---------] 9.67%. Success rate: 47.37%
spotpython tuning: -3.700837102694352 [#---------] 10.00%. Success rate: 50.00%
spotpython tuning: -3.7153829121872306 [#---------] 10.33%. Success rate: 52.38%
spotpython tuning: -3.7153829121872306 [#---------] 10.67%. Success rate: 50.00%
spotpython tuning: -3.7600786528206087 [#---------] 11.00%. Success rate: 52.17%
spotpython tuning: -3.7600786528206087 [#---------] 11.33%. Success rate: 50.00%
spotpython tuning: -3.914187810047026 [#---------] 11.67%. Success rate: 52.00%
spotpython tuning: -3.914187810047026 [#---------] 12.00%. Success rate: 50.00%
spotpython tuning: -3.914187810047026 [#---------] 12.33%. Success rate: 48.15%
spotpython tuning: -3.914187810047026 [#---------] 12.67%. Success rate: 46.43%
spotpython tuning: -3.914187810047026 [#---------] 13.00%. Success rate: 44.83%
spotpython tuning: -3.914187810047026 [#---------] 13.33%. Success rate: 43.33%
spotpython tuning: -3.914187810047026 [#---------] 13.67%. Success rate: 41.94%
spotpython tuning: -3.9187818909670287 [#---------] 14.00%. Success rate: 43.75%
spotpython tuning: -3.9187818909670287 [#---------] 14.33%. Success rate: 42.42%
spotpython tuning: -3.9380805605074545 [#---------] 14.67%. Success rate: 44.12%
spotpython tuning: -3.9380805605074545 [##--------] 15.00%. Success rate: 42.86%
spotpython tuning: -3.9380805605074545 [##--------] 15.33%. Success rate: 41.67%
spotpython tuning: -3.9380805605074545 [##--------] 15.67%. Success rate: 40.54%
spotpython tuning: -3.9380805605074545 [##--------] 16.00%. Success rate: 39.47%
spotpython tuning: -3.9380805605074545 [##--------] 16.33%. Success rate: 38.46%
spotpython tuning: -3.9380805605074545 [##--------] 16.67%. Success rate: 37.50%
spotpython tuning: -3.9380805605074545 [##--------] 17.00%. Success rate: 36.59%
spotpython tuning: -3.9380805605074545 [##--------] 17.33%. Success rate: 35.71%
spotpython tuning: -3.9380805605074545 [##--------] 17.67%. Success rate: 34.88%
spotpython tuning: -3.9380805605074545 [##--------] 18.00%. Success rate: 34.09%
spotpython tuning: -3.9380805605074545 [##--------] 18.33%. Success rate: 33.33%
spotpython tuning: -3.9380805605074545 [##--------] 18.67%. Success rate: 32.61%
spotpython tuning: -3.9380805605074545 [##--------] 19.00%. Success rate: 31.91%
spotpython tuning: -3.9380805605074545 [##--------] 19.33%. Success rate: 31.25%
spotpython tuning: -3.9380805605074545 [##--------] 19.67%. Success rate: 30.61%
spotpython tuning: -3.9380805605074545 [##--------] 20.00%. Success rate: 30.00%
spotpython tuning: -3.9380805605074545 [##--------] 20.33%. Success rate: 29.41%
spotpython tuning: -3.9380805605074545 [##--------] 20.67%. Success rate: 28.85%
spotpython tuning: -3.940845641215152 [##--------] 21.00%. Success rate: 30.19%
spotpython tuning: -3.940845641215152 [##--------] 21.33%. Success rate: 29.63%
spotpython tuning: -3.940845641215152 [##--------] 21.67%. Success rate: 29.09%
spotpython tuning: -3.9568347953028393 [##--------] 22.00%. Success rate: 30.36%
spotpython tuning: -3.96454592090996 [##--------] 22.33%. Success rate: 31.58%
spotpython tuning: -3.96454592090996 [##--------] 22.67%. Success rate: 31.03%
spotpython tuning: -4.061097781561253 [##--------] 23.00%. Success rate: 32.20%
spotpython tuning: -4.061097781561253 [##--------] 23.33%. Success rate: 31.67%
spotpython tuning: -4.061097781561253 [##--------] 23.67%. Success rate: 31.15%
spotpython tuning: -4.104757419590582 [##--------] 24.00%. Success rate: 32.26%
spotpython tuning: -4.112275959952993 [##--------] 24.33%. Success rate: 33.33%
spotpython tuning: -4.112275959952993 [##--------] 24.67%. Success rate: 32.81%
spotpython tuning: -4.335306114005691 [##--------] 25.00%. Success rate: 33.85%
spotpython tuning: -4.335306114005691 [###-------] 25.33%. Success rate: 33.33%
spotpython tuning: -4.335306114005691 [###-------] 25.67%. Success rate: 32.84%
spotpython tuning: -4.335306114005691 [###-------] 26.00%. Success rate: 32.35%
spotpython tuning: -4.335306114005691 [###-------] 26.33%. Success rate: 31.88%
spotpython tuning: -4.335306114005691 [###-------] 26.67%. Success rate: 31.43%
spotpython tuning: -4.335306114005691 [###-------] 27.00%. Success rate: 30.99%
spotpython tuning: -4.335306114005691 [###-------] 27.33%. Success rate: 30.56%
spotpython tuning: -4.335306114005691 [###-------] 27.67%. Success rate: 30.14%
spotpython tuning: -4.335306114005691 [###-------] 28.00%. Success rate: 29.73%
spotpython tuning: -4.335306114005691 [###-------] 28.33%. Success rate: 29.33%
spotpython tuning: -4.335306114005691 [###-------] 28.67%. Success rate: 28.95%
spotpython tuning: -4.335306114005691 [###-------] 29.00%. Success rate: 28.57%
spotpython tuning: -4.335306114005691 [###-------] 29.33%. Success rate: 28.21%
spotpython tuning: -4.335306114005691 [###-------] 29.67%. Success rate: 27.85%
spotpython tuning: -4.335306114005691 [###-------] 30.00%. Success rate: 27.50%
spotpython tuning: -4.335306114005691 [###-------] 30.33%. Success rate: 27.16%
spotpython tuning: -4.335306114005691 [###-------] 30.67%. Success rate: 26.83%
spotpython tuning: -4.335306114005691 [###-------] 31.00%. Success rate: 26.51%
spotpython tuning: -4.349953327548434 [###-------] 31.33%. Success rate: 27.38%
spotpython tuning: -4.349953327548434 [###-------] 31.67%. Success rate: 27.06%
spotpython tuning: -4.3556954908179195 [###-------] 32.00%. Success rate: 27.91%
spotpython tuning: -4.3556954908179195 [###-------] 32.33%. Success rate: 27.59%
spotpython tuning: -4.509690693492589 [###-------] 32.67%. Success rate: 28.41%
spotpython tuning: -4.509690693492589 [###-------] 33.00%. Success rate: 28.09%
spotpython tuning: -4.8144230493542075 [###-------] 33.33%. Success rate: 28.89%
spotpython tuning: -4.8144230493542075 [###-------] 33.67%. Success rate: 28.57%
spotpython tuning: -4.9798296688308294 [###-------] 34.00%. Success rate: 29.35%
spotpython tuning: -5.061804447194246 [###-------] 34.33%. Success rate: 30.11%
spotpython tuning: -5.068805215301591 [###-------] 34.67%. Success rate: 30.85%
spotpython tuning: -5.068937936537999 [####------] 35.00%. Success rate: 31.58%
spotpython tuning: -5.068937936537999 [####------] 35.33%. Success rate: 31.25%
spotpython tuning: -5.0693856330183 [####------] 35.67%. Success rate: 31.96%
spotpython tuning: -5.097605666806478 [####------] 36.00%. Success rate: 32.65%
spotpython tuning: -5.097605666806478 [####------] 36.33%. Success rate: 32.32%
spotpython tuning: -5.097605666806478 [####------] 36.67%. Success rate: 32.00%
spotpython tuning: -5.097605666806478 [####------] 37.00%. Success rate: 32.00%
spotpython tuning: -5.108082345310976 [####------] 37.33%. Success rate: 32.00%
spotpython tuning: -5.108082345310976 [####------] 37.67%. Success rate: 32.00%
spotpython tuning: -5.10971565772392 [####------] 38.00%. Success rate: 33.00%
spotpython tuning: -5.119101727220994 [####------] 38.33%. Success rate: 33.00%
spotpython tuning: -5.146144319877087 [####------] 38.67%. Success rate: 34.00%
spotpython tuning: -5.159788618791162 [####------] 39.00%. Success rate: 35.00%
spotpython tuning: -5.186041963675058 [####------] 39.33%. Success rate: 35.00%
spotpython tuning: -5.186041963675058 [####------] 39.67%. Success rate: 35.00%
spotpython tuning: -5.186041963675058 [####------] 40.00%. Success rate: 34.00%
spotpython tuning: -5.186041963675058 [####------] 40.33%. Success rate: 33.00%
spotpython tuning: -5.186041963675058 [####------] 40.67%. Success rate: 32.00%
spotpython tuning: -5.271369644997498 [####------] 41.00%. Success rate: 32.00%
spotpython tuning: -5.337779793085441 [####------] 41.33%. Success rate: 33.00%
spotpython tuning: -5.391971551727751 [####------] 41.67%. Success rate: 34.00%
spotpython tuning: -5.418306586761781 [####------] 42.00%. Success rate: 35.00%
spotpython tuning: -5.420104788483694 [####------] 42.33%. Success rate: 35.00%
spotpython tuning: -5.426067560552733 [####------] 42.67%. Success rate: 36.00%
spotpython tuning: -5.426564414991146 [####------] 43.00%. Success rate: 36.00%
spotpython tuning: -5.426564414991146 [####------] 43.33%. Success rate: 35.00%
spotpython tuning: -5.443676572304984 [####------] 43.67%. Success rate: 35.00%
spotpython tuning: -5.4633146938767645 [####------] 44.00%. Success rate: 36.00%
spotpython tuning: -5.477615111957468 [####------] 44.33%. Success rate: 36.00%
spotpython tuning: -5.478604285489354 [####------] 44.67%. Success rate: 37.00%
spotpython tuning: -5.504507606911687 [####------] 45.00%. Success rate: 37.00%
spotpython tuning: -5.539150313162945 [#####-----] 45.33%. Success rate: 38.00%
spotpython tuning: -5.539150313162945 [#####-----] 45.67%. Success rate: 38.00%
spotpython tuning: -5.539150313162945 [#####-----] 46.00%. Success rate: 38.00%
spotpython tuning: -5.5402625697832315 [#####-----] 46.33%. Success rate: 39.00%
spotpython tuning: -5.56197982541873 [#####-----] 46.67%. Success rate: 40.00%
spotpython tuning: -5.56197982541873 [#####-----] 47.00%. Success rate: 40.00%
spotpython tuning: -5.5811344795367885 [#####-----] 47.33%. Success rate: 40.00%
spotpython tuning: -5.612992839457602 [#####-----] 47.67%. Success rate: 41.00%
spotpython tuning: -5.612992839457602 [#####-----] 48.00%. Success rate: 40.00%
spotpython tuning: -5.612992839457602 [#####-----] 48.33%. Success rate: 40.00%
spotpython tuning: -5.620842134324741 [#####-----] 48.67%. Success rate: 41.00%
spotpython tuning: -5.751257788938613 [#####-----] 49.00%. Success rate: 42.00%
spotpython tuning: -5.751257788938613 [#####-----] 49.33%. Success rate: 42.00%
spotpython tuning: -5.751257788938613 [#####-----] 49.67%. Success rate: 42.00%
spotpython tuning: -5.761010571085683 [#####-----] 50.00%. Success rate: 43.00%
spotpython tuning: -5.761010571085683 [#####-----] 50.33%. Success rate: 43.00%
spotpython tuning: -5.790758646287819 [#####-----] 50.67%. Success rate: 44.00%
spotpython tuning: -5.874789104880129 [#####-----] 51.00%. Success rate: 45.00%
spotpython tuning: -5.9196338836489915 [#####-----] 51.33%. Success rate: 46.00%
spotpython tuning: -5.9196338836489915 [#####-----] 51.67%. Success rate: 46.00%
spotpython tuning: -5.926903517624601 [#####-----] 52.00%. Success rate: 47.00%
spotpython tuning: -5.926903517624601 [#####-----] 52.33%. Success rate: 47.00%
spotpython tuning: -5.927271499583316 [#####-----] 52.67%. Success rate: 48.00%
spotpython tuning: -5.927271499583316 [#####-----] 53.00%. Success rate: 48.00%
spotpython tuning: -5.927271499583316 [#####-----] 53.33%. Success rate: 48.00%
spotpython tuning: -5.927271499583316 [#####-----] 53.67%. Success rate: 48.00%
spotpython tuning: -5.927271499583316 [#####-----] 54.00%. Success rate: 48.00%
spotpython tuning: -5.927271499583316 [#####-----] 54.33%. Success rate: 47.00%
spotpython tuning: -5.927271499583316 [#####-----] 54.67%. Success rate: 47.00%
spotpython tuning: -5.927271499583316 [######----] 55.00%. Success rate: 47.00%
spotpython tuning: -5.927271499583316 [######----] 55.33%. Success rate: 46.00%
spotpython tuning: -5.970382340113862 [######----] 55.67%. Success rate: 46.00%
spotpython tuning: -5.970382340113862 [######----] 56.00%. Success rate: 46.00%
spotpython tuning: -5.98037098740973 [######----] 56.33%. Success rate: 46.00%
spotpython tuning: -5.983949623329151 [######----] 56.67%. Success rate: 47.00%
spotpython tuning: -5.983949623329151 [######----] 57.00%. Success rate: 47.00%
spotpython tuning: -5.983949623329151 [######----] 57.33%. Success rate: 46.00%
spotpython tuning: -5.984446052495568 [######----] 57.67%. Success rate: 46.00%
spotpython tuning: -5.984446052495568 [######----] 58.00%. Success rate: 46.00%
spotpython tuning: -5.984446052495568 [######----] 58.33%. Success rate: 45.00%
spotpython tuning: -5.984446052495568 [######----] 58.67%. Success rate: 45.00%
spotpython tuning: -5.984446052495568 [######----] 59.00%. Success rate: 45.00%
spotpython tuning: -5.984446052495568 [######----] 59.33%. Success rate: 45.00%
spotpython tuning: -5.984446052495568 [######----] 59.67%. Success rate: 45.00%
spotpython tuning: -5.984446052495568 [######----] 60.00%. Success rate: 45.00%
spotpython tuning: -5.984446052495568 [######----] 60.33%. Success rate: 45.00%
spotpython tuning: -5.984446052495568 [######----] 60.67%. Success rate: 45.00%
spotpython tuning: -5.985767174704916 [######----] 61.00%. Success rate: 46.00%
spotpython tuning: -5.98612452134311 [######----] 61.33%. Success rate: 47.00%
spotpython tuning: -5.98612452134311 [######----] 61.67%. Success rate: 47.00%
spotpython tuning: -5.98612452134311 [######----] 62.00%. Success rate: 47.00%
spotpython tuning: -5.98612452134311 [######----] 62.33%. Success rate: 47.00%
spotpython tuning: -5.98612452134311 [######----] 62.67%. Success rate: 47.00%
spotpython tuning: -5.98612452134311 [######----] 63.00%. Success rate: 47.00%
spotpython tuning: -5.98612452134311 [######----] 63.33%. Success rate: 47.00%
spotpython tuning: -5.98612452134311 [######----] 63.67%. Success rate: 47.00%
spotpython tuning: -5.986340357603932 [######----] 64.00%. Success rate: 48.00%
spotpython tuning: -5.986340357603932 [######----] 64.33%. Success rate: 48.00%
spotpython tuning: -5.986340357603932 [######----] 64.67%. Success rate: 47.00%
spotpython tuning: -5.986666699280313 [######----] 65.00%. Success rate: 48.00%
spotpython tuning: -5.987478160773967 [#######---] 65.33%. Success rate: 48.00%
spotpython tuning: -5.987478160773967 [#######---] 65.67%. Success rate: 48.00%
spotpython tuning: -5.9875932503528695 [#######---] 66.00%. Success rate: 48.00%
spotpython tuning: -5.987616015588548 [#######---] 66.33%. Success rate: 49.00%
spotpython tuning: -5.987639137965227 [#######---] 66.67%. Success rate: 49.00%
spotpython tuning: -5.987639137965227 [#######---] 67.00%. Success rate: 49.00%
spotpython tuning: -5.9876635297715906 [#######---] 67.33%. Success rate: 49.00%
spotpython tuning: -5.987730630190587 [#######---] 67.67%. Success rate: 49.00%
spotpython tuning: -5.987740535459417 [#######---] 68.00%. Success rate: 49.00%
spotpython tuning: -5.987740535459417 [#######---] 68.33%. Success rate: 48.00%
spotpython tuning: -5.987799498927747 [#######---] 68.67%. Success rate: 49.00%
spotpython tuning: -5.9878884332530005 [#######---] 69.00%. Success rate: 49.00%
spotpython tuning: -5.987920778292953 [#######---] 69.33%. Success rate: 49.00%
spotpython tuning: -5.988077164883673 [#######---] 69.67%. Success rate: 50.00%
spotpython tuning: -5.988158156187611 [#######---] 70.00%. Success rate: 51.00%
spotpython tuning: -5.988158156187611 [#######---] 70.33%. Success rate: 51.00%
spotpython tuning: -5.988189201066602 [#######---] 70.67%. Success rate: 51.00%
spotpython tuning: -5.9882059749805165 [#######---] 71.00%. Success rate: 52.00%
spotpython tuning: -5.988210636332465 [#######---] 71.33%. Success rate: 52.00%
spotpython tuning: -5.988210636332465 [#######---] 71.67%. Success rate: 51.00%
spotpython tuning: -5.988210636332465 [#######---] 72.00%. Success rate: 50.00%
spotpython tuning: -5.988211420037823 [#######---] 72.33%. Success rate: 50.00%
spotpython tuning: -5.988217463907028 [#######---] 72.67%. Success rate: 50.00%
spotpython tuning: -5.988264083556442 [#######---] 73.00%. Success rate: 51.00%
spotpython tuning: -5.988347546746793 [#######---] 73.33%. Success rate: 52.00%
spotpython tuning: -5.988360137171808 [#######---] 73.67%. Success rate: 53.00%
spotpython tuning: -5.988379888322772 [#######---] 74.00%. Success rate: 54.00%
spotpython tuning: -5.988418688939662 [#######---] 74.33%. Success rate: 54.00%
spotpython tuning: -5.988423451687884 [#######---] 74.67%. Success rate: 54.00%
spotpython tuning: -5.988429687850103 [########--] 75.00%. Success rate: 54.00%
spotpython tuning: -5.988437278240213 [########--] 75.33%. Success rate: 54.00%
spotpython tuning: -5.988456771717686 [########--] 75.67%. Success rate: 54.00%
spotpython tuning: -5.988456771717686 [########--] 76.00%. Success rate: 53.00%
spotpython tuning: -5.988457197692498 [########--] 76.33%. Success rate: 53.00%
spotpython tuning: -5.988457197692498 [########--] 76.67%. Success rate: 53.00%
spotpython tuning: -5.988457197692498 [########--] 77.00%. Success rate: 52.00%
spotpython tuning: -5.988457399729264 [########--] 77.33%. Success rate: 52.00%
spotpython tuning: -5.98845754598811 [########--] 77.67%. Success rate: 52.00%
spotpython tuning: -5.98845857471826 [########--] 78.00%. Success rate: 52.00%
spotpython tuning: -5.9884606868142 [########--] 78.33%. Success rate: 52.00%
spotpython tuning: -5.988460865706653 [########--] 78.67%. Success rate: 52.00%
spotpython tuning: -5.988461427019045 [########--] 79.00%. Success rate: 53.00%
spotpython tuning: -5.988463241163481 [########--] 79.33%. Success rate: 54.00%
spotpython tuning: -5.988463241163481 [########--] 79.67%. Success rate: 53.00%
spotpython tuning: -5.988469243986287 [########--] 80.00%. Success rate: 53.00%
spotpython tuning: -5.988488158032255 [########--] 80.33%. Success rate: 54.00%
spotpython tuning: -5.988540233288079 [########--] 80.67%. Success rate: 54.00%
spotpython tuning: -5.988568745858723 [########--] 81.00%. Success rate: 54.00%
spotpython tuning: -5.988568745858723 [########--] 81.33%. Success rate: 54.00%
spotpython tuning: -5.988571432723718 [########--] 81.67%. Success rate: 55.00%
spotpython tuning: -5.988572532080666 [########--] 82.00%. Success rate: 55.00%
spotpython tuning: -5.988572532080666 [########--] 82.33%. Success rate: 54.00%
spotpython tuning: -5.98857285588239 [########--] 82.67%. Success rate: 55.00%
spotpython tuning: -5.988574075180419 [########--] 83.00%. Success rate: 56.00%
spotpython tuning: -5.988576440100829 [########--] 83.33%. Success rate: 56.00%
spotpython tuning: -5.988576440100829 [########--] 83.67%. Success rate: 56.00%
spotpython tuning: -5.988576440100829 [########--] 84.00%. Success rate: 55.00%
spotpython tuning: -5.988576834809703 [########--] 84.33%. Success rate: 55.00%
spotpython tuning: -5.988576834809703 [########--] 84.67%. Success rate: 54.00%
spotpython tuning: -5.988576834809703 [########--] 85.00%. Success rate: 54.00%
spotpython tuning: -5.988576834809703 [#########-] 85.33%. Success rate: 53.00%
spotpython tuning: -5.988578559007278 [#########-] 85.67%. Success rate: 54.00%
spotpython tuning: -5.988578559007278 [#########-] 86.00%. Success rate: 53.00%
spotpython tuning: -5.988579153588369 [#########-] 86.33%. Success rate: 54.00%
spotpython tuning: -5.988579153588369 [#########-] 86.67%. Success rate: 54.00%
spotpython tuning: -5.988581116484535 [#########-] 87.00%. Success rate: 55.00%
spotpython tuning: -5.988581116484535 [#########-] 87.33%. Success rate: 55.00%
spotpython tuning: -5.988582523200371 [#########-] 87.67%. Success rate: 56.00%
spotpython tuning: -5.988582523200371 [#########-] 88.00%. Success rate: 56.00%
spotpython tuning: -5.988582523200371 [#########-] 88.33%. Success rate: 56.00%
spotpython tuning: -5.988582523200371 [#########-] 88.67%. Success rate: 56.00%
spotpython tuning: -5.988582523200371 [#########-] 89.00%. Success rate: 55.00%
spotpython tuning: -5.98858371998743 [#########-] 89.33%. Success rate: 56.00%
spotpython tuning: -5.988584867577959 [#########-] 89.67%. Success rate: 56.00%
spotpython tuning: -5.988584867577959 [#########-] 90.00%. Success rate: 55.00%
spotpython tuning: -5.988591291211196 [#########-] 90.33%. Success rate: 56.00%
spotpython tuning: -5.988594930740894 [#########-] 90.67%. Success rate: 57.00%
spotpython tuning: -5.9885957301869555 [#########-] 91.00%. Success rate: 57.00%
spotpython tuning: -5.98859697370479 [#########-] 91.33%. Success rate: 58.00%
spotpython tuning: -5.988598154464451 [#########-] 91.67%. Success rate: 59.00%
spotpython tuning: -5.988599382671316 [#########-] 92.00%. Success rate: 60.00%
spotpython tuning: -5.988602579358863 [#########-] 92.33%. Success rate: 61.00%
spotpython tuning: -5.988602579358863 [#########-] 92.67%. Success rate: 61.00%
spotpython tuning: -5.988606839136218 [#########-] 93.00%. Success rate: 62.00%
spotpython tuning: -5.988606839136218 [#########-] 93.33%. Success rate: 62.00%
spotpython tuning: -5.988608659529856 [#########-] 93.67%. Success rate: 63.00%
spotpython tuning: -5.988608659529856 [#########-] 94.00%. Success rate: 63.00%
spotpython tuning: -5.988608659529856 [#########-] 94.33%. Success rate: 62.00%
spotpython tuning: -5.988611703073841 [#########-] 94.67%. Success rate: 62.00%
spotpython tuning: -5.988612418896281 [##########] 95.00%. Success rate: 63.00%
spotpython tuning: -5.988614965370529 [##########] 95.33%. Success rate: 64.00%
spotpython tuning: -5.988616548302447 [##########] 95.67%. Success rate: 65.00%
spotpython tuning: -5.98861664484452 [##########] 96.00%. Success rate: 66.00%
spotpython tuning: -5.9886168536786615 [##########] 96.33%. Success rate: 67.00%
spotpython tuning: -5.9886168536786615 [##########] 96.67%. Success rate: 67.00%
spotpython tuning: -5.98861899064326 [##########] 97.00%. Success rate: 68.00%
spotpython tuning: -5.98861899064326 [##########] 97.33%. Success rate: 67.00%
spotpython tuning: -5.98861899064326 [##########] 97.67%. Success rate: 67.00%
spotpython tuning: -5.988619187442004 [##########] 98.00%. Success rate: 68.00%
spotpython tuning: -5.988624163385303 [##########] 98.33%. Success rate: 68.00%
spotpython tuning: -5.9886251152636625 [##########] 98.67%. Success rate: 68.00%
spotpython tuning: -5.988630936108615 [##########] 99.00%. Success rate: 69.00%
spotpython tuning: -5.988630936108615 [##########] 99.33%. Success rate: 68.00%
spotpython tuning: -5.988644042675007 [##########] 99.67%. Success rate: 68.00%
spotpython tuning: -5.988669065435721 [##########] 100.00%. Success rate: 68.00% Done...
Experiment saved to 000_res.pkl
<spotpython.spot.spot.Spot at 0x132351310>
S_micha.plot_progress(log_y=False, title="sklearn Kriging Progress with y")
print(f"[10D] Kriging y: min y = {S_micha.min_y:.4f} at x = {S_micha.min_X}")[10D] Kriging y: min y = -5.9887 at x = [2.20081795 2.71163367 2.21906084 2.48190887 2.62732398 1.89634636
2.08792031 1.36061956 1.28291073 1.21695533]
Plot of the surrogate model in the first two dimensions:
model = S_micha.surrogate
fig, axes = plotModel(
model=model,
lower=lower,
upper=upper,
i=0,
j=1,
n_grid=100,
contour_levels=20,
)
25.2.5 Evaluation of 30 repeats with Kriging and Matern kernel
Sine 30 repeats were performed and stored in spot_michalewicz.json, we can now evaluate the results:
# Load results from spot_michalewicz.json
with open("spot_michalewicz.json", "r") as f:
data = json.load(f)
# Extract all "evaluations" values
evals = [
iteration["sampled_locations"][0]["evaluations"]
for iteration in data["search_iterations"]
]
# Compute mean and standard deviation
mean_eval = np.mean(evals)
std_eval = np.std(evals)
print(f"Mean of evaluations: {mean_eval:.6f}")
print(f"Standard deviation of evaluations: {std_eval:.6f}")Mean of evaluations: -5.390014
Standard deviation of evaluations: 1.048200
25.3 Jupyter Notebook
- The Jupyter-Notebook of this chapter is available on GitHub in the Hyperparameter-Tuning-Cookbook Repository