1

I am performing hyperparameter search over a large space using skopt.BayesSearchCV. I am running it on a machine that restarts at 7pm every day. I want to be able to save the state of the BayesSearchCV so I can restart the search from where I left off after the machine starts up again.

I see there is a CheckpointSaver callback, but the documentation only covers how to use it with gp_minimize. BayesSearchCV does take a callback parameter, and I have tried passing CheckpointSaver into it, but it appears to only save the optimizer result, something that cannot directly be passed to BayesSearchCV.

Is there a way to use CheckpointCallback to restart BayesSearchCV? Or is there any other method someone knows about that would accomplish the same goal?

jet457
  • 211
  • 2
  • 5
  • I see [BayesSearchCV.fit()](https://scikit-optimize.github.io/stable/modules/generated/skopt.BayesSearchCV.html#skopt.BayesSearchCV.fit) has a callback parameter. Have you tried passing the CheckpointSaver as a callback there? – Nick ODell Aug 13 '22 at 19:31
  • 1
    Yep, and it saves a pkl, but it appears to be a pkl of the optimizer result, not the BayesSearchCV. The docs describe how to pass this to gp_minimize, but not how to use it to restart BayesSearchCV. – jet457 Aug 14 '22 at 11:12
  • so you just want to save the data to file at 6:59pm and then read the last saved file on the next open. – D.L Aug 14 '22 at 16:20
  • @D.L Saving things to pickle and reloading is fine, the trickier part is actually restarting the BayesSearchCV from where it left off. If there was a way to save the state of a whole running python program, then resume it after 7pm, that would get around the whole problem. Most of what I could find on this was about pickling python objects, not the program state itself. – jet457 Aug 14 '22 at 19:12
  • This is currently an open issue: https://github.com/scikit-optimize/scikit-optimize/issues/1025 – jet457 Aug 24 '22 at 10:52

0 Answers0