我希望能够使用库skopt从检查点恢复高斯过程。经过一番研究,我找不到这样做的方法。
这是一个简单的代码来显示我想要做什么:
import skopt
LOAD = False # To continue the optimization from a checkpoint, I would like to be able to set True here
x = skopt.space.Real(low=-10, high=10, name='x')
y = skopt.space.Real(low=-10, high=10, name='y')
dimensions = [x, y]
x0 = [0, 0]
@skopt.utils.use_named_args(dimensions=dimensions)
def f_to_minimize(x, y):
return (x * y) ** 2 + (x + 2) ** 2
checkpoint_callback = skopt.callbacks.CheckpointSaver(
checkpoint_path='checkpoint.pkl',
)
saved_checkpoint = None
if LOAD:
saved_checkpoint = skopt.load('checkpoint.pkl') # <- How can I use this ?
search_result = skopt.optimizer.gp_minimize(
func=f_to_minimize,
dimensions=dimensions,
x0=x0,
callback=[checkpoint_callback],
n_calls=2,
n_random_starts=1,
)
我希望能够从以前的高斯过程优化中加载一个检查点并继续它,这样模型就不必再次从头开始学习所有内容。有没有办法这样做?