skopt.callbacks
.CheckpointSaver#
- class skopt.callbacks.CheckpointSaver(checkpoint_path, **dump_options)[source][source]#
Save current state after each iteration with
skopt.dump
. Allows to re- use previously computed function evaluations.- Parameters:
- checkpoint_pathstring
location where checkpoint will be saved to;
- dump_optionsstring
options to pass on to
skopt.dump
, likecompress=9
Examples
>>> import skopt >>> def obj_fun(x): ... return x[0]**2 >>> checkpoint_callback = skopt.callbacks.CheckpointSaver("./result.pkl") >>> skopt.gp_minimize(obj_fun, [(-2, 2)], n_calls=10, ... callback=[checkpoint_callback]) >>> # when re-using stored results. >>> checkpoint_callback = skopt.callbacks.CheckpointSaver("./result.pkl") >>> skopt.gp_minimize(obj_fun, [(-2, 2)], n_calls=10, ... callback=[checkpoint_callback] ... **checkpoint_callback.load())
Methods
__call__
(res)- Parameters:
load
()Loads from disk previously evaluated points.