Support linearize log integer properly #658
Merged
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.
[Fixes #552]
Why:
A log integer dimension would be casted to real, linearized, then casted
back to integer. This reduces dramatically the number of possible values
that can be sampled as many exp(int(log(x))) will result in the same
integer for many different values of x. An algorithm that needs
linearization should be able to handle real space or otherwise state a
requirement for integers. This should be handled separately and
quantization of linearized log integer should not be applied by default.
Note:
Due to the use of floor instead of rounding in Quantize, the values of
int(exp(log(x))) would still clash for close values of x. Using rounding
instead solves the issue. Rounding may be problematic however for
algorithms that require integer type, as the rounding may cast real
integers to values that are out-of-bound. For now there are no
foreseeable algorithms that may require integer type so I avoid fixing
the issue and leave it for later if the need even arises (which I highly
doubt).