Uh oh!
There was an error while loading. Please reload this page.
Report each start's final objective value at the end of a multi-start fit (#658) - #674
Merged
Conversation
Several fit types run more than one search from different starting points and report the best result. That single number cannot be checked. Twenty starts that all reached about the same objective value mean the fit has very likely found the best answer available and that more starts would not help. Twenty starts that all landed somewhere different mean the reported answer is only the least bad of twenty poor ones. Both cases used to print one number and nothing else. A fit with more than one start now writes Results/multistart_summary.txt, one row per start sorted by final objective value from best to worst, and prints a short version of it at the end of the run. Each row gives the objective that start reached, the steps it took, the simulations it cost, and why it stopped. Reading the objective column downward is the check the parameter fitting literature calls a waterfall plot. This covers trf, lbfgs, gntr, powell, sim, ms, the polishing phase of profile_likelihood, and the metaheuristics de, ade, ss and pso. A start that was still running when the fit ended, and a start the fit never reached, are both listed and labelled, so a run stopped early by wall_time_fit cannot be misread as a complete set of starts that agreed with each other. Nothing is written for a fit with a single start. No fitting method searches any differently. This also fixes a bug found while doing the work. A bootstrap replicate of a multiple shooting fit kept the previous replicate's ladder results, so it could report a start belonging to the replicate before it in continuity_defects.txt and in the best stage trace.
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes#658.
A fit that runs several searches from different starting points reports the best of them. That one number cannot be checked. Twenty starts that all reached about the same objective value mean the fit has very likely found the best answer available. Twenty starts that all landed somewhere different mean the reported answer is only the least bad of twenty poor ones. Both cases used to print one number and nothing else.
A fit with more than one start now writes
Results/multistart_summary.txt, one row per start sorted by final objective value from best to worst, and prints a short version of it at the end of the run.Here is the file from a Powell fit with six starts on a two-mode test objective.
The file also carries a short comment block above that explaining how to read it. On screen the run prints:
A start that was still running when the fit ended, and a start the fit never reached, are both listed and labelled. Otherwise a run cut short by
wall_time_fitwould print a short table that reads as a complete set of starts that agreed with each other. Nothing is written for a fit with a single start, since there would be nothing to compare it against. No fitting method searches any differently.What is covered
trf,lbfgs,gntr,powell,sim,ms, the polishing phase ofprofile_likelihood, and the metaheuristicsde,ade,ssandpso.The issue left the metaheuristics optional. They are included here because
deis the default fit type, so leaving them out would have left the most common multi-start fit with no report. Those methods keep no per-start iteration count that means the same thing across all of them, so their iterations column readsn/aand the evaluations column carries the work each start cost instead.A bug fixed along the way
A bootstrap replicate of a multiple shooting fit reuses the algorithm object, and the list of per-start ladder results was never cleared between replicates. Everything that reports on the ladder reads that list, so the second replicate could report a start belonging to the first, fitted to different resampled data, as the one behind
Results/continuity_defects.txtand the best stage trace. The list is now cleared on reset. The new test fails without the fix.Where the code went
The row type and the formatting are in a new module,
pybnf/algorithms/multistart_report.py. Three families of fit type produce these rows and each keeps the numbers somewhere different, so the shared part sits apart from all three. Each family fills inAlgorithm.multistart_records, andAlgorithm._emit_multistart_summarywrites whatever it is handed. A failure writing the file is logged and swallowed, as it is for the other end of run reports.Testing
New tests in
tests/test_multistart_summary.pycover the formatting on its own and all three families. The concurrent local optimizers and the metaheuristics are driven end to end through the real run loop against an analytical objective. Multiple shooting is checked white box, since that fit type needs a sensitivity capable simulation backend. One new test intests/test_shooting_sbml.pycovers the bootstrap bug.Local runs: the default suite is 4745 passed and 14 skipped, the slow tier is 49 passed, and the gradient, profile likelihood and shooting modules pass with their recovery tests included. The docs build with no new warnings.