brainmass.hyperbolic_tangent_coupling

brainmass.hyperbolic_tangent_coupling#

brainmass.hyperbolic_tangent_coupling(delayed_x, conn, k=0.5, scale=2.0)#

Hyperbolic-tangent coupling kernel (function form, post-nonlinearity).

The TVB HyperbolicTangent coupling: a symmetric saturating nonlinearity is applied after the network sum,

\[c_i = k \, \tanh\!\left(\mathrm{scale} \sum_j w_{ij} x_j\right).\]
Parameters:
  • delayed_x (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Zero-arg callable (e.g. a Prefetch / prefetch_delay) or array returning the source signal, shaped (..., N_out, N_in) or flattened (..., N_out * N_in).

  • conn (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Connection weights, (N_out, N_in) or square-flattened (N_out * N_in,).

  • k (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Global coupling strength (TVB G; G k). The output saturates to ±k.

  • scale (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Scaling of the network sum before the tanh.

Returns:

Coupling output with shape (..., N_out). tanh is dimensionless, so the output carries the units of k.

Return type:

ArrayLike

See also

sigmoidal_coupling

asymmetric (logistic) post-nonlinearity.

additive_coupling

the underlying linear coupling.

Notes

The argument of tanh must be dimensionless; the network sum is reduced to its magnitude (brainunit.get_magnitude) before the nonlinearity. As |sum| the output saturates to ±k.

References

Examples

>>> import brainmass
>>> import jax.numpy as jnp
>>> conn = jnp.ones((2, 2))
>>> x = jnp.full((2, 2), 1e3)  # large positive net input saturates to +k
>>> out = brainmass.hyperbolic_tangent_coupling(x, conn, k=0.5, scale=2.0)
>>> [round(float(v), 3) for v in out]
[0.5, 0.5]