You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not really an sbi bug but a pytorch one, but good to be aware anyway if using custom prior distributions:
in pytorchTransformedDistributions, support is computed as: support = self.transforms[-1].codomain, which ignores any constraints of the base distribution and any intermediate transformations, which is problematic if the base distribution is, e.g., Uniform. This results in accepting posterior samples that are outside of prior bounds when checked in sbiutils.within_support(). This is a known issue in pytorch.
To fix it, one can either:
manually reassigning transforms[-1].codomain to be, e.g., the transformed bounds of the Uniform distribution (hacky but fast), or
in sbiutils.within_support(), call .log_prob() to detect if there are samples that raises an error, which happens if it's outside of the distribution's support (works in general, but ugly and slow).
Just to re-iterate: this error will occur, e.g., during .train() of SNPE-C (second round), when prior.log_prob() is called. This gives an error because it is evaluated outside of the prior support.
This is not really an
sbi
bug but apytorch
one, but good to be aware anyway if using custom prior distributions:in
pytorch
TransformedDistributions,support
is computed as:support = self.transforms[-1].codomain
, which ignores any constraints of the base distribution and any intermediate transformations, which is problematic if the base distribution is, e.g.,Uniform
. This results in accepting posterior samples that are outside of prior bounds when checked insbiutils.within_support()
. This is a known issue in pytorch.To fix it, one can either:
transforms[-1].codomain
to be, e.g., the transformed bounds of the Uniform distribution (hacky but fast), orsbiutils.within_support()
, call.log_prob()
to detect if there are samples that raises an error, which happens if it's outside of the distribution's support (works in general, but ugly and slow).@michaeldeistler anything else to add?
The text was updated successfully, but these errors were encountered: