skopt.callbacks.CheckpointSaver

class skopt.callbacks.CheckpointSaver(checkpoint_path, **dump_options)[source][source]

Save current state after each iteration with skopt.dump.

Parameters
checkpoint_pathstring

location where checkpoint will be saved to;

dump_optionsstring

options to pass on to skopt.dump, like compress=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]) # doctest: +SKIP

Methods

__call__(self, res)

Parameters

__init__(self, checkpoint_path, **dump_options)[source][source]

Initialize self. See help(type(self)) for accurate signature.

Examples using skopt.callbacks.CheckpointSaver