NegativeT#

class brainstate.nn.NegativeT#

Transformation constraining parameters to be strictly negative (-∞, 0).

This is a convenience class that provides a simple negative constraint using the negative softplus transformation with upper bound of 0.

The transformation is defined by:

\[\text{forward}(x) = -\log(1 + e^{-x})\]

The inverse transformation is:

\[\text{inverse}(y) = -\log(e^{-y} - 1)\]

Examples

>>> transform = NegativeT()
>>> x = jnp.array([-5.0, 0.0, 5.0])
>>> y = transform.forward(x)
>>> # y ≈ [-5.007, -0.693, -0.007]
forward(x)[source]#

Transform unbounded input to negative values.

Return type:

Array

inverse(y)[source]#

Transform negative input back to unbounded domain.

Return type:

Array