Is there a way to keep track of which sample is currently running when using sbiopredictionci with bootrap?

I want to compute the Bootstrap 95% confidence interval using sbiopredictionci after the optimization (sbiofit) of my model parameters. The whole process is being done programatically (not through Simbiology GUI). However, because of the large model, it can take a long time to run many Bootstrap samples, so I was wondering if there is a way to implement some type of progress bar, or even just print to the command window which sample is currently running. I couldn't find a solution online, unfortunately, other than using a custom Bootstrap function instead of calling sbiopredictionci. Is there any way to do this?

Answers (1)

I can't think of a simple and direct way to do this, but I might be able to suggest some workarounds depending on the details of your setup. And on Monday, I'll talk to the developer who wrote sbiopredictionci to see if he has any other ideas. For additional background, I see that the sampling loop is in bootci (from Statistics and Machine Learning toolbox), and that function doesn't have any built-in support for displaying any sort of progress.
I think the biggest question is whether you are passing in UseParallel=true when you call sbiopredictionci. If not, I can share a few more ideas. If you are parallelizing, then things are even trickier. I'm not sure what I'd do for that case.

2 Comments

Thanks Arthur! I am not parallelizing currently, so let me know if you have any thoughts, please.
What I just tried was adding a conditional breakpoint (see dbstop for details) whose only purpose is to print out which iteration of the bootstrap samples we're on. The hardest part about that was finding where I need to put that breakpoint. In my R2024b installation (Update 9, in case that matters), I executed the following line of code to set the appropriate breakpoint:
dbstop in internal.stats.parallel.smartForSliceout at 170 if fprintf("Iteration="+iter+newline)==0
Line 170 is the first line of code inside the for loop in my installation. The file and line number could potentially change if you update MATLAB, but it looks like it hasn't changed recently.
The fprint command gets evaluated every time we get to that line of code. It then prints out the iteration. If the expressoin evaluates to true the debugger will stop on that line, so I add the ==0 to make sure we don't actually stop.
If you prefer, you can also set the breakpoint by opening the relevant file in the MATLAB Editor, right-click on the line number, select "Set Conditional Breakpoint..." and then type in the fprintf expression, or whatever code you want to execute when you get to that line.
Let me know if/how that works for you.

Sign in to comment.

Communities

More Answers in the  SimBiology Community

Categories

Products

Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!