You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because of the use of multiprocessing library of Python, the first argument of minimize() must be a top-level function to become pickle-able. Hence, Smac library cannot be used in a class.
The text was updated successfully, but these errors were encountered:
This is true. The reasoning behind that is that each call to the function is executed in a separate subprocess. This way, the resources used by the call (like CPU-time, memory etc...) can be limited.
Depending on your use-case, you have two (potentially more) options:
wrap whatever class method you want to minimize by a function that instantiates the class object (it could create it from scratch, or load a pickled version from disk) and then calls the method. This would be feasible, if you class is small/fast to construct compared to the execution.
if your class is large and cannot be instantiated for every call, you could let pySMAC minimize a function that communicates via IPC (sockets, queue or similar) to a separate process that hosts your class object. This requires more code on your end, and limiting the resources inside pySMAC becomes useless, as the process that might exceed any limit wasn't created by SMAC. It would be your responsibility to ensure that the host process stops after a time limit has been reached or too much memory was allocated.
Let me know if you have any other questions or comments on that.
Best,
Stefan
Because of the use of
multiprocessing
library of Python, the first argument ofminimize()
must be a top-level function to becomepickle
-able. Hence, Smac library cannot be used in a class.The text was updated successfully, but these errors were encountered: