bijx.Power

class bijx.Power[source]

Bases: ScalarBijection

Power transformation for positive values.

Applies a power transformation to positive inputs with a learnable exponent.

Type: \([0, \infty] \to [0, \infty]\)

Transform: \(x^p\) where \(p > 0\)

Parameters:
  • exponent (Union[Variable, Array, ndarray, Sequence[Union[int, Any]]]) – Exponent parameter specification, transformed to ensure positivity.

  • transform_exponent (Callable | None) – Function to ensure positive exponent (default: abs).

  • rngs – Random number generators for parameter initialization.

Note

The constraint \(p > 0\) is not validated, but by default enforced by the transform_exponent function. Thus could also set exponent to a constant negative value or integer (wrapped in Const, to avoid training) after setting transform_exponent=None.

Example

>>> bijection = Power(rngs=rngs)  # Starts with p=1
>>> x = jnp.array([0.5, 1.0, 2.0])
>>> y, log_det = bijection.forward(x, jnp.zeros(3))
__init__(exponent=(), transform_exponent=<PjitFunction of <function abs>>, *, rngs=None)[source]
Parameters:
  • exponent (Variable | Array | ndarray | Sequence[int | Any])

  • transform_exponent (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.

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\).