bijx.ScalarBijection¶
- class bijx.ScalarBijection[source]¶
Bases:
Bijection
Base class for element-wise one-dimensional bijections.
This abstract class provides the foundation for scalar (element-wise) bijections. It automatically handles log-density updates by summing log-Jacobian contributions over event dimensions, following the change of variables formula for element-wise transformations.
- Subclasses must implement:
The
forward()
andreverse()
methods are implemented automatically and handle log-density updates by summing scalar log-Jacobians over event axes.Important
The
forward
andreverse
methods should NOT be overridden.- __init__(*args, **kwargs)¶
Methods
forward
(x, log_density, **kwargs)Apply forward transformation with log-density update.
fwd
(x, **kwargs)Apply forward transformation.
invert
()Create an inverted version of this bijection.
log_jac
(x, y, **kwargs)Compute log absolute determinant of the Jacobian.
rev
(y, **kwargs)Apply reverse (inverse) transformation.
reverse
(y, log_density, **kwargs)Apply reverse transformation with log-density update.
- log_jac(x, y, **kwargs)[source]¶
Compute log absolute determinant of the Jacobian.
- Parameters:
x – Input values where Jacobian is computed.
y – Output values corresponding to x (i.e., y = fwd(x)).
**kwargs – Additional transformation-specific arguments.
- Returns:
Log absolute Jacobian determinant \(\log \abs{f'(x)}\) with same shape as x.
- fwd(x, **kwargs)[source]¶
Apply forward transformation.
- Parameters:
x – Input values to transform.
**kwargs – Additional transformation-specific arguments.
- Returns:
Transformed values \(y = f(x)\) with same shape as \(x\).
- rev(y, **kwargs)[source]¶
Apply reverse (inverse) transformation.
- Parameters:
y – Output values to inverse-transform.
**kwargs – Additional transformation-specific arguments.
- Returns:
Inverse-transformed values \(x = f^{-1}(y)\) with same shape as \(y\).
- forward(x, log_density, **kwargs)[source]¶
Apply forward transformation with log-density update.
Transforms input through the bijection and updates log-density by subtracting the log-Jacobian determinant, summed over event dimensions.