Simbiology data fitting program is constantly running nonstop
Show older comments
Hey guys,
Does anyone have experience with fitting the data in Simbiology but the program just running for more than 30 minutes? I am experienceing this recently with Matlab R2020b. I am trying to fitting biodistribution data into my 15 compartments PBPK model. My model worked without error and warning when I first estimated 6 parameters I am interested in with simulation program build in the Simbiology app. After I got similar simulation to my animal data. I switched to data fitting program build in the Simbiology app. Here came the problem. Everytime when I run the data fitting, the figure of "Progress Plot for Isqnonlin" did pop up and ran correctly with the porgress showed in the figure and showed the End time and Elapsed time after the run. However, the program just keep running nonstop for more than 30 minute. I took so long that I can only force quite my matlab. There's no result and summery come up after waiting for 30 minute. All the setings for the fitting I used are defult setup in the program. How could I deal with this problem?
Answers (2)
Sietse Braakman
on 15 Dec 2020
0 votes
Hi Jesse,
It is not uncommon for estimation programs to take that long. The duration of the fitting process depends on many factors:
- The complexity of your model: If you have a larger model (more ODEs and algebraic equations), it will take longer to numerically solve the model. Generally, the optimization process requires the equations to be solved for each iteration (pooled fit) and/or each individual in your dataset at each iteration (unpooled fit and mixed effects estimation)
- The effective stop time for the simulation. During a fit, this would be determined by the last time point in your dataset. If you only have to simulate your model for 1 day vs 1 month, that makes a difference
- The solver settings for the ODE solver: if you tolerances are unnecessarily low, the ODE solver will take more steps than is necessary to simulate the model. You can set these tolerances in the simulation settings window. I found this documentation page helpful wrt the absolute and relative tolerance: Absolute and Relative Tolerance
- The solver settings for the optimization algorithm: if your termination criteria are too restrictive, the optimization may never terminate. Generally, you have a termination criteria for the objective function (you can glean what a fair termination criterium from the log-likelihood in the progress plot), for the parameter estimate, for the first-order optimality (a measure of the gradient at the optimal point that can also be gleaned from the progress plot, only for gradient-based optimization methods), and the maximum number of iterations (this is not a desirable termination criterion because it doesn't represent a mathematical optimum).
- The number of parameters you are estimating. The higher the number, the higher the dimensionality of your search space.
- The optimization algorithm: local optimization algorithms (lsqnonlin, fmincon, fminsearch, fminunc, nlinfit) are generally fastest, global optimization algorithms (scattersearch, patternseach, ga, particleswarm) generally require many more iterations due to their mathematical approach. Mixed effects algorithms, also require more iterations than local algorithms, so they may also take longer. Especially for the mixed effects algorithms, the default termination criteria tend to be conservative, so you may want loosen these criteria. We are also aware of the nlmefitsa algorithm taking a very long time to converge.
- There may be an identifiability issue where some of the parameters you are trying to estimate are not identifiable. See this webinar for more info on identifiability and sensitivity analysis for parameter estimation: https://www.rosaandco.com/webinars/2019/parameter-estimation-to-establish-confidence-model-predictions
Some of the things you could do:
- Make sure your optimization is still progressing after 30 minutes by looking at the progress plot - if so, either wait longer, use parallel computing toolbox (will only help on unpooled, mixed effects or global optimization fits) to speed up the optimization, try changing the termination criteria.
- Investigate identifiability of your parameters, e.g. using the AliasingScore app for SimBiology models
- Reduce the number of parameters you are estimating
Let me know how you get on.
Best,
Sietse
3 Comments
Fulden Buyukozturk
on 15 Dec 2020
Hi Jesse,
In addition to what Sietse already wrote, a suggestion could be to set a reasonable value on max wall clock (via the simulation settings if using the app).
A very common reason things appear stuck during a fit is because of a very slow simulation. Even when things appear to have “converged”, a subsequent simulation could step into a “bad” set of parameter values. So setting a reasonable max wall clock might help.
Fulden
Sietse Braakman
on 15 Dec 2020
Jesse, I have one additional question - how many individuals are there in your dataset? Could it be that plotting takes a long time? In that case, you can turn plotting off in the fit program and see if that solves your problem. (See screenshot)
Another thought, related to Fulden's suggestion, is that it could be that the final estimates from your fit, cause your model to be very stiff. Your ODE solver will then have to take very small steps to meet its tolerances, leading to long simulation times
Jesse Chao
on 18 Dec 2020
Jesse Chao
on 12 Jan 2021
0 votes
1 Comment
Fulden Buyukozturk
on 12 Jan 2021
Hi Jesse, it would be very diffucult to reproduce this issue on our end without the project file. Could you share it? If so, you can contact me directly from my profile.
Communities
More Answers in the SimBiology Community
Categories
Find more on Scan Parameter Ranges in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!