Profile: Improve step-size defaults and step-size robustness#1711
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1711 +/- ##
===========================================
+ Coverage 84.28% 84.31% +0.03%
===========================================
Files 164 164
Lines 14645 14752 +107
===========================================
+ Hits 12343 12438 +95
- Misses 2302 2314 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
We were changing the step size of profiling parameter to 0 by accident.
- explicit absolute/relative profile step-size options - deprecated old absolute step-size option names - per-parameter step-size family resolution from `ub - lb` - finite-bound validation before profiling - single upfront step-size resolution before profile walking - resolved step sizes passed through profiling tasks/proposals - lightweight many-steps precheck warning/error mode - focused profile tests for options, resolution, precheck
|
Thanks @dweindl for the comments, I updated the step-size handling quite a bit so here's a short summary:
|
| default_step_size_absolute: float = 0.02, | ||
| default_step_size_relative: float = 0.01, | ||
| min_step_size_absolute: float = 0.01, | ||
| min_step_size_relative: float = 0.005, | ||
| max_step_size_absolute: float = 0.2, |
There was a problem hiding this comment.
As the goal here is improving robustness, I am wondering if the absolute step sizes shouldn't be much smaller. Or disabled by default?! For a parameter in [1e-4, 1e-3], the current defaults wouldn't be too helpful. Do you see a case where just relying on relative tolerances would be problematic?
There was a problem hiding this comment.
The only downside I see of using only relative stepping is that it would take unnecessary many steps for very tightly constrained parameters, e.g., if there is a parameter with range 0-2 (some exponent).
The absolute step sizes I chose here were chosen based on the profiling benchmark -- as a tradeoff between robustness and speed. So I would keep them as such. But you do raise a good point -- actually the relative defaults should be different, better thought through. Generally, the median range of parameters the benchmark spanned 8 orders of magnitude.
So making the relative method kick in when the span exceeds 8 would be appropriate. And then from then on it would make as many steps as it would make for parameters with span 8. That would make the relative defaults be:
min_step_size_relative = 0.00125
default_step_size_relative = 0.0025
max_step_size_relative = 0.025
So for very small ranges the absolute method would cause the step size to be appropriate and finish the profiling quickly. For ones exceeding 8 orders of magnitude, the relative stepping would kick in which would cause all profiling to have per default step size 400 steps, and per min step size (worse case scenario) 800 steps.
PaulJonasJost
left a comment
There was a problem hiding this comment.
I am not fully clear on the usefulness of the Resolved Step size, i.e. adding data class, multiple checks at multiple points etc, for it to check two simple calculations of "how many steps are expected" and "How many in a worst case?". Have I missed a crucial functionality for them?
It's more just an implementational thing. It causes for very simple downstream coding as we can call |
Absolute profiling step sizes can be too small for parameters with very wide bounds. This PR updates profiling step-size handling so that pyPESTO can choose between absolute and relative step sizes per profiled parameter.
Relative step sizes are computed as fractions of the parameter span
ub - lbon the optimization scale. pyPESTO then uses either the full absolute or the full relative step-size family, based on the resolved default step size.Also:
0