Closed pierresegonne closed 3 years ago
Thanks for your report! The reason to this behavior is that the check for support doesn't trigger here: https://github.com/toshas/torch_truncnorm/blob/main/TruncatedNormal.py#L90-L93
The actual values within the support should be correct. You can add a check in the given context and either return -inf or throw an exception.
Ah right! Thanks for the answer!
Do you want me to propose a fix for this ? :)
@pierresegonne thank you, a pull request would be great! I think it'd make sense to copy the behavior of other distributions with a limited support, such as e.g. Beta
Committed https://github.com/toshas/torch_truncnorm/commit/7ad2e22e2a26a6cb53234befa06754367b3ad0e0 and detailed in the subsequent commits. Thanks for the initial pull request, I will close it now with this ticket.
Hey! Thanks for sharing this!
To test briefly the truncated normal distribution, I wanted to verify the pdf and wrote the following snippet
Resulting in the following plot profile. Did I completely miss the point or is the truncation not happening ?
Thanks :)