Fix calibrateEB interpolation threshold condition#787
Open
sims1253 wants to merge 1 commit into
Open
Conversation
calibrateEB() chooses between an exact gbayes() evaluation and a faster interpolation according to the number of variance estimates. The condition `length(vars >= 200)` measured the comparison result rather than vars, so it was true for every non-empty input and left the exact branch unreachable. Use `length(vars) >= 200`, as described by the existing comment, so inputs below the threshold use the exact calculation. Both paths target the same posterior, so the practical numerical difference is small. Add regression coverage for exact evaluation below the threshold and a sanity check of interpolation at the threshold.
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 free
to 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.
calibrateEB() chooses between an exact gbayes() evaluation and a faster interpolation according to the number of variance estimates. The condition
length(vars >= 200)measured the comparison result rather than vars, so it was true for every non-empty input and left the exact branch unreachable.Use
length(vars) >= 200, as described by the existing comment, so inputs below the threshold use the exact calculation. Both paths target the same posterior, so the practical numerical difference is small.Add regression coverage for exact evaluation below the threshold and a sanity check of interpolation at the threshold.
Found during my https://github.com/sims1253/ry audit