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
{{ message }}
Repository navigation
bug: transform_to_unconstrained z-scoring is a silent no-op for nflows flows #1885
Passing z_score_x="transform_to_unconstrained" (or z_score_y) to an nflows flow
builder (build_maf, build_maf_rqs, build_nsf, build_made, and the MDN path)
silently builds a flow with no reparametrization at all. There is no error and no
warning. Thus,if the user asks for an unconstrained-space transform they just gets a raw flow,
i.e. a subtly wrong posterior. Only the Zuko builders actually implement the option.
The reason is not a parser bug, but just that we forgot to cover this for nflows or mdn: z_score_parser returns (False, False) for transform_to_unconstrained on
purpose, because the caller is expected to special-case it. The Zuko path does this
(flow.py, via biject_transform_zuko(mcmc_transform(x_dist))), but the nflows
builders never got that branch, so the flag parses to "no z-scoring" and nothing
replaces it.
Solution (short term, fail loudly):
raise an informative NotImplementedError for transform_to_unconstrained in the
nflows builders, pointing users to zuko_* models or independent/structured/none
a warning is not enough here: training would silently proceed with wrong
normalization, and since the current behavior is a no-op nobody can be relying on it
put the check in the nflows builders, not in z_score_parser (the Zuko path relies
on the parser returning (False, False) after special-casing the flag); a small
shared guard in sbiutils.py called at the top of each nflows builder keeps it DRY
Long term (actually implement it for nflows):
unlike independent/structured, this option needs the prior distribution
(x_dist / mcmc_transform), which the nflows builders don't currently receive
threading that through is the same "z-scoring depends on prior bounds, not the
batch" axis as the planned builder/z-scoring refactor, so it could be part of that
bigger effort rather than a standalone fix
this is now partially fixed by #1886 which introduces warnings for the no-op paths.
For the long term fix I suggest to actually not implement it for nflows (un-maintained, dead end), but only for our internal methods, e.g., for mdn and potentially for the vector field methods. For the latter we need to take into account the recent PR #1884
Activity
janfb commentedon Jun 23, 2026
this is now partially fixed by #1886 which introduces warnings for the no-op paths.
For the long term fix I suggest to actually not implement it for
nflows(un-maintained, dead end), but only for our internal methods, e.g., formdnand potentially for the vector field methods. For the latter we need to take into account the recent PR #1884BHARATH0153 commentedon Jun 23, 2026
@janfb working on it
feat(vfpe): implement transform_to_unconstrained z-scoring for vector…