deephyper.skopt.callbacks.CheckpointSaver

deephyper.skopt.callbacks.CheckpointSaver#

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

Bases: object

Save current state after each iteration with deephyper.skopt.dump.

Examples

>>> import deephyper.skopt
>>> def obj_fun(x):
...     return x[0]**2
>>> checkpoint_callback = deephyper.skopt.callbacks.CheckpointSaver("./result.pkl")
>>> deephyper.skopt.gp_minimize(obj_fun, [(-2, 2)], n_calls=10,
...                   callback=[checkpoint_callback]) 
Parameters:
  • checkpoint_path (string) – location where checkpoint will be saved to;

  • dump_options (string) – options to pass on to deephyper.skopt.dump, like compress=9

Methods

__call__(res)[source]#
Parameters:

res (OptimizeResult, scipy object) – The optimization as a OptimizeResult object.