How do I do parameters Estimation in SimBiology using Optimization toolbox?
Afficher commentaires plus anciens
Hi
I am trying to perform parameter optimization in SimBiology using optimization function from the optimization toolbox. As an test, I tried to do parameter estimation shown in the 'sbioparamestim' example here - http://www.mathworks.com/help/simbio/ref/sbioparamestim.html to check if I get the same answers. My code is as follows, the driver file (Estimation_Driver.m)
%%Driver to test sbioparamestim using optimization toolbox
sbioloadproject('gprotein_norules');
p_array = sbioselect(m1,'Type','parameter');
for index = 1:size(p_array,1)
k0(index,1) = p_array(index).Value;
end
[error] = Objective_func(k0,m1);
f = @(k)Objective_func(k,m1);
options = optimset('Display','iter');
[k,res_error] = lsqnonlin(f,k0);
And the file calculating the error is as follows (Objective_func.m)
function [error] = Objective_func(k,m)
Gt = 10000;
tspan = [0 10 30 60 110 210 300 450 600]';
Ga_frac = [0 0.35 0.4 0.36 0.39 0.33 0.24 0.17 0.2]';
xtarget = Ga_frac * Gt;
% Assign the parameters
for index = 1:length(k)
m.Parameters(index).Value = k(index,1);
end
[soln_obj] = sbiosimulate(m);
[t1,Ga,~] = selectbyname(soln_obj,'Ga');
Ga_sim = interp1(t1,Ga,tspan);
error = xtarget - Ga_sim;
My question is - why are my answers (below) different than the answers in the example?
ans =
0.0100
-0.0000
0.0004
4.0000
0.0040
1.0000
0.0000
0.1100
and the residual is
1.2176e+06
which are different from the values on the 'sbioparamestim' help page, and even the termination message are different :(my message - below):
Optimization running.
Objective function value: 1217576.5248185194
Local minimum possible.
lsqnonlin stopped because the size of the current step is less than
the default value of the step size tolerance.
and the message when I run using 'sbioparamestim':
Local minimum possible.
lsqnonlin stopped because the size of the current step is less than
the default value of the step size tolerance.
Stopping criteria details:
Optimization stopped because the norm of the current step, 5.676554e-11,
is less than options.TolX = 1.000000e-06.
Optimization Metric Options
norm(step) = 5.68e-11 TolX = 1e-06 (default)
Am I not using the same conditions as in 'sbioparamestim' (I didn't change any of the default conditions in 'lsqnonlin'?
More importantly, is this the correct way to use an optimization solver if I don't want to use 'sbioparamestim' (I find it easier to pose my problem this way, for simulating experiments which are much more complex)?
Any help here would be useful. Thanks!
SN
2 commentaires
Ingrid Tigges
le 11 Mar 2013
Which release of MATLAB are you using? I had a look into the example but it only contains the lines
sbioloadproject gprotein_norules m1;
Gt = 10000;
tspan = [0 10 30 60 110 210 300 450 600]';
Ga_frac = [0 0.35 0.4 0.36 0.39 0.33 0.24 0.17 0.2]';
xtarget = Ga_frac * Gt;
p_array = sbioselect(m1,'Type','parameter');
Ga = sbioselect(m1,'Type','species','Name','Ga');
[k, result] = sbioparamestim(m1, tspan, xtarget, Ga, p_array)
And not all the other code you provided.
S N
le 11 Mar 2013
Réponse acceptée
Plus de réponses (1)
Shashank Prasanna
le 11 Mar 2013
Optimization is tricky business. You will have to see why you solver stopped and then relax the tolerances till you find a better result. You may end up getting stuck in local minima depending on your initial conditions as well.
This message should give you the hint:
Local minimum possible.
lsqnonlin stopped because the size of the current step is less than
the default value of the step size tolerance.
Try relaxing the tolerances for TolX and try again.
I recommend going through this nicely written page which has good steps to follow when you hit a wall this way. http://www.mathworks.com/help/optim/ug/when-the-solver-fails.html
1 commentaire
Sietse Braakman
le 12 Juil 2019
Here is a general guidance on parameter estimation with SimBiology:
Communautés
Plus de réponses dans SimBiology Community
Catégories
En savoir plus sur Scan Parameter Ranges dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!