Fix numerical precision problem with smax in hyperband #77
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.
Motivation
For certain inputs, the flooring of smax, as prescribed in the original paper
, results in a lower smax than should be the case due to machine precision. This is particularly problematic because it is an issue for
η = 3
, which is the most common case. See the demonstration below:For some values, log(η, R) ends up being slightly lower than it is analytically. Combine this with a flooring operator, and you get problems - max_reductions is what you want, but s_max is what you get. For
η ∈ {5, 6, 7, 8}
, the output is occutionally slightly higher than it should be. This is no problem due to thefloor
operator, which is why the proposed fix only checks for equality when rounding up (byceil
), and fixes potential problems by rounding up. The undershooting is again a problem forη = 9
, and that concludes my limited testing.Proposed fix
To remedy this, I propose cheching to see if
log(η, R)
is an integer within the default precision, and if it is, rounding it. In my limited testing, I did not see this produce the wrong result at any point, but it does fix the problem.