Parameter estimation in biological network

I am working on a large signaling pathway and trying to get a rough estimation of the baseline parameters. I have been trying to do the fitting with the Particle Swarm Optimization from Metaheuristics.jl but it does not converge properly.

Here is the part related to the optimization:

# time points from each data set (first column: time points, second column: values)

t1 = data[1][:,1];
t2 = data[2][:,1];
t3 = data[3][:,1];
t4 = data[4][:,1];
t5 = data[5][:,1];
t6 = data[6][:,1];
t7 = data[7][:,1];
t8 = data[8][:,1];
t9 = data[9][:,1];
t10 = data[10][:,1];
t11 = data[11][:,1];

t = [t1;t2;t3;t4;t5;t6;t7;t8;t9;t10;t11];

# Remove repeated time points
t=unique(sort(t));

# indices for the respective model outputs
indices =[2, 65, 67, 69, 39, 44, 14, 31, 29, 25, 74];

# objective function
function obj_fun(p)
    err = 0.0;

    alg = AutoTsit5(Rosenbrock23(autodiff=false));

    prob = ODEProblem(model!, collect(init), tspan, p, callback=cbs);

    sol = solve(prob, alg=alg, saveat = t);

    for i in 1:11

        for (j,t) in enumerate(data[i][:,1])

# Experimental data are normalized to the maximum concentration on each dataset

            err = err + ((sol(t)[indices[i]] - maximum(sol[indices[i],:])*data[i][j,2]))^2;

        end
    end
    return err
end

bounds = BoxConstrainedSpace(lb = lb, ub = ub);

options = Options(f_calls_limit = 500*length(param), f_tol = 1e-3);

algorithm = PSO(N = 100, options = options);

result = optimize(obj_fun, bounds, algorithm);

p_est = minimizer(result);

The minimum optimization result is around 223, and many parameters remain the same. Does anyone have any experience in tackling this issue, e.g. different objective functions, algorithms etc?

Thanks!

Just a quick reply. Don’t create the ODEProblem inside the objective function; rather, create the problem outside and use either solve(...; p = new_params) or remake.
For example like here: Parameter Estimation of Ordinary Differential Equations · SciMLSensitivity.jl

See also Global Optimization via NLopt · DiffEqParamEstim.jl or GitHub - sebapersson/PEtab.jl: Create parameter estimation problems for ODE models for more automatic frameworks.

My personal note: If you have only a few parameters and don’t know the system well, maybe spend a few hours making a data frame with p -> obj_fun(p) with randomly sampled values for p and plot the data to learn about your system. That way, you can see what the obj_fun looks like and judge if you need something complicated.
(For me, often the solvers from BlackBoxOptim.jl seem to work well. But it depends on the problem class you are in. And reasonable upper/lower bounds might be half of the trick.)

Thanks for your reply!

My model is large (77 ODEs, 162 parameters), while I have 11 datasets, one for a different output. Also, the datasets contain different time points and normalized values to the maximum measured concentration on each dataset.

Do you think PEtab can handle large models with the above features? It looks helpful.

I am not experienced enough with that many parameters. Just today the JuliaCon talk was uploaded (I haven’t watched it yet, but maybe it was informative):

Thank you a lot! I just tried to install PEtab.jl but I get the following error:

223 dependencies successfully precompiled in 829 seconds. 368 already precompiled.
  104 dependencies precompiled but different versions are currently loaded. Restart julia to access the new versions
  2 dependencies had output during precompilation:
┌ BlackBoxOptim
│  [pid 4384] waiting for IO to finish:
│   Handle type        uv_handle_t->data
│   fs_event           0000018fbf51aa50->0000018fc304c490
│   timer              0000018fc3ddc0c0->0000018fc304c4c0
│  This means that a package has started a background task or event source that has not finished running. For precompilation to complete successfully, the event source needs to be closed explicitly. See the developer documentation on fixing precompilation hangs for more help.
└
┌ LinearSolve
│   Downloading artifact: IntelOpenMP
│
│  [pid 27832] waiting for IO to finish:
│   Handle type        uv_handle_t->data
│   timer              0000024dd59368d0->0000024dd1e8d900
│  This means that a package has started a background task or event source that has not finished running. For precompilation to complete successfully, the event source needs to be closed explicitly. See the developer documentation on fixing precompilation hangs for more help.
│
│  [pid 27832] waiting for IO to finish:
│   Handle type        uv_handle_t->data
│   timer              0000024dd59368d0->0000024dd1e8d900
│  This means that a package has started a background task or event source that has not finished running. For precompilation to complete successfully, the event source needs to be closed explicitly. See the developer documentation on fixing precompilation hangs for more help.
└
  4 dependencies errored.
  For a report of the errors see `julia> err`. To retry use `pkg> precompile`

It might be some compatibility issue with BlackBoxOptim.jl?

For this kind of error, try first to restart Julia and precompile again… Maybe it goes away.

[Or remove BlackBoxOptim, I guess it is not required for PEtab.]

I tried restarting Julia, removing BlackBoxOptim and reinstalling PEtab.jl but still got the following:

Precompiling project...
  ✗ PEtab → PEtabOptimizationExtension
  ✗ PEtab → PEtabOptimExtension
  ✗ PEtab → PEtabPlotsExtension
  42 dependencies successfully precompiled in 92 seconds. 549 already precompiled. 1 skipped during auto due to previous errors.

But does the code work? (I am maybe forgetful, but I had in mind sometimes it just happens to work even though some precompiling fails; or at least you get a better error msg.)