bijx.Scaling¶
- class bijx.Scaling[source]¶
Bases:
ScalarBijection
Scaling transformation.
Applies element-wise scaling with a learnable scale parameter. This is a simpler version of
AffineLinear
without the shift term.Type: \([-\infty, \infty] \to [-\infty, \infty]\)
Transform: \(ax\) where \(a\) is a learnable scale parameter
- Parameters:
scale (
Union
[Variable
,Array
,ndarray
,Sequence
[Union
[int
,Any
]]]) – Scale parameter specification.transform_scale (
Callable
|None
) – Function to transform scale (default: None/identity).rngs – Random number generators for parameter initialization.
Note
The scale parameter is initialized to 1 (identity scaling). No positivity constraint is applied by default.
Example
>>> bijection = Scaling(rngs=rngs) >>> x = jnp.array([-1.0, 0.0, 1.0]) >>> y, log_det = bijection.forward(x, jnp.zeros(3)) >>> # Initially y == x (scale=1)
- __init__(scale=(), transform_scale=None, *, rngs=None)[source]¶
- Parameters:
scale (Variable | Array | ndarray | Sequence[int | Any])
transform_scale (Callable | None)
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.