skopt.utils.dump(res, filename, store_objective=True, **kwargs)[source][source]

Store an skopt optimization result into a file.

resOptimizeResult, scipy object

Optimization result object to be stored.

filenamestring or pathlib.Path

The path of the file in which it is to be stored. The compression method corresponding to one of the supported filename extensions (‘.z’, ‘.gz’, ‘.bz2’, ‘.xz’ or ‘.lzma’) will be used automatically.

store_objectiveboolean, default=True

Whether the objective function should be stored. Set store_objective to False if your objective function (.specs['args']['func']) is unserializable (i.e. if an exception is raised when trying to serialize the optimization result).

Notice that if store_objective is set to False, a deep copy of the optimization result is created, potentially leading to performance problems if res is very large. If the objective function is not critical, one can delete it before calling skopt.dump() and thus avoid deep copying of res.

**kwargsother keyword arguments

All other keyword arguments will be passed to joblib.dump.