pyPESTO icon indicating copy to clipboard operation
pyPESTO copied to clipboard

`ScipyDifferentialEvolutionOptimizer` appears to load the AMICI model many times

Open dilpath opened this issue 3 years ago • 4 comments

Bug description Many of these messages in the log file, possibly every function evaluation during optimization.

Using existing amici model in folder /.../amici_models/icg_body.

Expected behavior Only one of these messages.

To reproduce Run the example in #881

Replacing the optimizer with pypesto.optimize.ScipyOptimizer() results in the expected behavior.

Environment

  • Operating system: Ubuntu 20.04
  • pypesto version: current develop branch, commit https://github.com/ICB-DCM/pyPESTO/commit/1e30f36f41bce2645b13ac2928c392d22edc44c0
  • Python version: 3.8.10

dilpath avatar Jun 23 '22 11:06 dilpath

It's expected that this message shows up N times for ScipyDifferentialEvolutionOptimizer(..., workers=N), because the objective is pickled there for each worker. Wouldn't consider that a bug.

dweindl avatar Jul 12 '22 10:07 dweindl

The messages appear far greater than N times, e.g. using the problem from #881 and the following script.

import pypesto.petab
import pypesto.optimize

petab_yaml = 'icg_sd.yaml'
pypesto_importer = pypesto.petab.PetabImporter.from_yaml(petab_yaml)
pypesto_problem = pypesto_importer.create_problem()

optimizer = pypesto.optimize.ScipyDifferentialEvolutionOptimizer(
    options={
        'strategy': 'best1bin',
        'maxiter': 8000,
        'mutation': (0.2, 1),
        'recombination': 0.7,
        'popsize': 70,
        'init': 'latinhypercube',
        'polish': True,
        'workers': 8,
    }
)

result = pypesto.optimize.minimize(
    pypesto_problem,
    optimizer=optimizer,
    n_starts=4,
    filename=None,
)

dilpath avatar Jul 12 '22 11:07 dilpath

Okay, potentially multiplied by popsize or maxiter :see_no_evil: .

The best we can do is not showing the message during unpickling. The rest is on scipy.

dweindl avatar Jul 12 '22 11:07 dweindl

Moved "using existing" message to debug level in #912, should reduce appearance unless in debug mode.

yannikschaelte avatar Aug 03 '22 20:08 yannikschaelte