Erros in multi_runs
- When performed on a simple example, i.e. from the example folder the assertion in line 300 is triggered. I think this is because worker function return tuple and not list.
AssertionError: results not list of lists, is: ...
- In a more advanced/personal example I use a class holding the objective function as a method:
class MyTester:
def __init__(self, model, data):
self.model = model
self.data = data
def my_test_objective(self, **pars):
procID = pars['process_id']
del pars['process_id']
for par in pars:
self.model.setValue(par, pars[par])
res = self.model.simulate(0, 100, 100)
f = sum((self.data - res['[A]'])**2)
self.model.reset()
return f
test_model = """k = 0.5;
A=10;
A->;A*k"""
t = np.arange(0, 100)
test_data = 10 * (np.exp(-0.1 * t) + np.random.normal(0, 0.03 , len(t)))
This makes it easy to calculate score based on simulation and data, without loading hard coded model and data in the objective function. Additionally, I want the objective function to take all parameters in my boundaries dict via **pars, without the need to change the objective function everytime I choose a different parameter space.
In this really personal scenario multi_runs fails as dill:
TypeError: can't pickle SwigPyObject objects
However, this is up to me @jorin
-
1. AssertionError -
2. TypeError