Sorting of optimization result with priors involved doesn't work
If priors are included and the optimization fails nan is written in result.optimize_result for fval instead of the usual inf and therefore the sorting of result.optimize_result doesn't work properly.
I am using the current develop branch of pyPESTO and AMICI.
Can be reproduced e.g. with the Elowitz-model from the benchmark collection after adding normally distributed priors around zero for the initial concentrations which will surely make some runs fails. i.e.the parameter table becomes
| parameterId | ... | objectivePriorType | objectivePriorParameters |
|---|---|---|---|
| KM | ... | ||
| background | ... | ||
| eff | ... | ||
| eff_GFP | ... | ||
| init_GFP | ... | normal | 0; 1 |
| init_GFP_mRNA | ... | normal | 0; 1 |
| init_X_mRNA | ... | normal | 0; 1 |
| init_X_protein | ... | normal | 0; 1 |
| init_Y_mRNA | ... | normal | 0; 1 |
| init_Y_protein | ... | normal | 0; 1 |
| init_Z_mRNA | ... | normal | 0; 1 |
| init_Z_protein | ... | normal | 0; 1 |
| n_Hill | ... | ||
| scale | ... | ||
| sigma | ... | ||
| tau_mRNA | ... | ||
| tau_mRNA_GFP | ... | ||
| tau_prot | ... | ||
| tau_prot_GFP | ... | ||
| tps_active | ... | ||
| tps_repr | ... |
This altered file is attached.
Then
import pypesto
import pypesto.petab
import petab
petab_problem = petab.Problem.from_yaml("Benchmark-Models/Elowitz_Nature2000/Elowitz_Nature2000.yaml")
importer = pypesto.petab.PetabImporter(petab_problem)
model = importer.create_model(verbose=False)
obj = importer.create_objective()
problem = importer.create_problem(obj)
optimizer = pypesto.optimize.ScipyOptimizer()
result = pypesto.optimize.minimize(problem=problem, optimizer=optimizer,
n_starts=20)
print(result.optimize_result.get_for_key('fval'))
outputs
[nan, -5.273827589103882, 14.223720396071306, 374502.751049893, nan, nan, nan, nan, nan, nan, 14.223697112161812, 157198.54584629158, 856908.663362333, nan, nan, nan, nan, -3.546770714032929, nan, 15242133642.081184]