Repository navigation
Add QMCSampler to TestRelativeSampler coverage and clamp log-float untransform at low bound - #6799
Conversation
QMCSampler to TestRelativeSampler coverage and clamp log-float untransform at low bound
|
This pull request has not seen any recent activity. |
| if d.single(): | ||
| param = trans_param | ||
| else: | ||
| param = min(trans_param, np.nextafter(d.high, d.high - 1)) |
There was a problem hiding this comment.
Would it make sense to use np.clip here as well?
There was a problem hiding this comment.
Here, min is used to ensure the suggested value falls within the range [low, high). Note that while the current specification uses [low, high], this remains unchanged to maintain backward compatibility with older behavior.
In this line, trans_param hasn't performed any transformations like exp, so I think that it can safely trust the values passed as arguments and doesn't need to perform clipping on the lower bound.
There was a problem hiding this comment.
Thank you for your review!
We plan to begin the code freeze process for the next release soon. While the discussion from these review comments is still ongoing, I'll merge the bug fixes from this PR to incorporate them in the next release.
Motivation
In
_SearchSpaceTransform.untransformforFloatDistribution(log=True), a direct round trip at the lower edge could come back slightly below low due to floating-point error, and that leaked into sampler behavior. The missing coverage showed up in sampler test matrices that had previously been removed.Description of the changes
Clamp log-scale float untransform results to both ends of the valid range, using [low, nextafter(high, high - 1)].
Restore sampler coverage for the cases that exercise this path: