sigmoid_rate_gg_1998_ipn#

class brainpy.state.sigmoid_rate_gg_1998_ipn(in_size, tau=Quantity(10., 'ms'), lambda_=1.0, sigma=1.0, mu=0.0, g=1.0, mult_coupling=False, linear_summation=True, rectify_rate=0.0, rectify_output=False, rate_initializer=Constant(value=0.0), noise_initializer=Constant(value=0.0), name=None)#

NEST-compatible sigmoid_rate_gg_1998_ipn nonlinear rate neuron with input noise.

Description

sigmoid_rate_gg_1998_ipn implements NEST’s sigmoid_rate_gg_1998_ipn model: a continuous-time rate neuron driven by stochastic input noise and shaped by the historical Gancarz-Grossberg (1998) quartic gain function. The model corresponds to NEST’s rate_neuron_ipn template instantiated with sigmoid_rate_gg_1998 nonlinearity. Multiplicative coupling factors are fixed to one for this model variant (the flag is kept for API compatibility).

1. Continuous-time stochastic dynamics

The neuron rate \(X(t)\) evolves under the Itô stochastic differential equation:

\[\tau\,dX(t) = \left[-\lambda X(t) + \mu + \phi(\cdot)\right]dt + \left[\sqrt{\tau}\,\sigma\right]dW(t),\]

where \(\tau > 0\) is the intrinsic time constant (ms), \(\lambda \ge 0\) is the passive decay rate, \(\mu\) is the constant mean drive, \(\sigma \ge 0\) is the input noise amplitude, and \(W(t)\) is a standard Wiener process.

2. Gancarz-Grossberg quartic gain function

The gain function \(\phi(h)\) applies a steep, saturating nonlinearity to summed synaptic input \(h\):

\[\phi(h) = \frac{(g\,h)^4}{0.1^4 + (g\,h)^4},\]

where \(g > 0\) is the gain parameter controlling horizontal scaling. This form, introduced by Gancarz & Grossberg (1998) for saccade generation modeling, provides faster saturation than standard sigmoid or Hill functions and approaches a binary step near threshold. The constant denominator term \(0.1^4 = 10^{-4}\) sets the half-activation point at \(h = 0.1/g\) when \(g=1\).

Compared with the standard sigmoid \(g/(1+e^{-\beta(h-\theta)})\), the quartic gain exhibits steeper rise and faster approach to asymptotic bounds, reflecting winner-take-all dynamics in reticular formation circuits.

3. Numerical integration scheme

At each time step \(h = dt\), the model applies the stochastic exponential Euler (Euler-Maruyama) scheme:

\[X_{n+1} = P_1\,X_n + P_2\,(\mu + \mu_{ext} + \phi(\cdot)) + \sqrt{\frac{\tau\,(-0.5\,\mathrm{expm1}(-2\lambda h/\tau))}{\lambda}}\,\xi_n,\]

where \(P_1 = e^{-\lambda h/\tau}\), \(P_2 = -\mathrm{expm1}(-\lambda h/\tau)/\lambda\) for \(\lambda > 0\), and \(\xi_n \sim \mathcal{N}(0, 1)\). For \(\lambda = 0\), the propagators reduce to \(P_1 = 1\), \(P_2 = h/\tau\), and the noise factor becomes \(\sqrt{h/\tau}\).

The external drive \(\mu_{ext}\) aggregates continuous current inputs and delta inputs via sum_current_inputs() and sum_delta_inputs().

4. Synaptic input routing and delayed events

When linear_summation=True (default), the gain \(\phi\) applies to the total summed synaptic input across all sources:

\[\phi(\cdot) = \phi(h_{ex,\mathrm{inst}} + h_{in,\mathrm{inst}} + h_{ex,\mathrm{del}} + h_{in,\mathrm{del}}),\]

where subscripts denote instantaneous vs. delayed, excitatory vs. inhibitory branch sums. When linear_summation=False, the gain applies to each incoming rate event before weighted summation, matching NEST’s per-event nonlinearity mode.

Delayed events are stored in per-step queues (_delayed_ex_queue, _delayed_in_queue) indexed by target step. Event polarity (excitatory or inhibitory) is determined by the sign of the weight field. Events support dict, tuple, or scalar formats:

  • {'rate': r, 'weight': w, 'delay_steps': d, 'multiplicity': m}

  • (r, w, d, m) or shorter tuples (defaults applied)

  • Scalar r (weight=1, delay_steps=0, multiplicity=1)

5. Update ordering

Per simulation step (matching NEST rate_neuron_ipn with sigmoid_rate_gg_1998):

  1. Store outgoing delayed value as current rate (delayed_rate).

  2. Draw noise realization \(\xi_n\).

  3. Propagate intrinsic dynamics \(-\lambda X\) with stochastic exponential Euler.

  4. Read delayed and instantaneous event buffers, schedule new delayed events.

  5. Apply gain function to branch sums (if linear_summation=True) or per event (if linear_summation=False).

  6. Apply rectification: if rectify_output=True, clamp rate to \(\ge\) rectify_rate.

  7. Store outgoing instantaneous value as updated rate (instant_rate).

6. Assumptions, constraints, and failure modes

  • Construction-time validation ensures tau > 0, lambda >= 0, sigma >= 0, rectify_rate >= 0.

  • Parameters are scalar or broadcastable to self.varshape.

  • Delayed event delay_steps must be non-negative integers; instantaneous events (instant_rate_events) must have delay_steps=0 or omit the field.

  • Multiplicative coupling factors are identically one (_mult_coupling_ex/in return ones_like). Enabling mult_coupling=True has no effect for this model.

  • Per-step complexity is \(O(|\mathrm{state}| \cdot K)\) for K events per step.

Parameters:
  • in_size (Size) – Population shape. Supports integer n (1D with n neurons), tuple (n, m) (2D grid), or higher-dimensional tuples.

  • tau (Quantity[ms], optional) – Intrinsic time constant \(\tau\) of rate dynamics (ms). Must be positive. Default 10 ms.

  • lambda (float or array_like, optional) – Passive decay rate \(\lambda\) (dimensionless). Must be non-negative. Default 1.0.

  • sigma (float or array_like, optional) – Input noise amplitude \(\sigma\) (dimensionless). Must be non-negative. Zero disables stochastic forcing. Default 1.0.

  • mu (float or array_like, optional) – Constant mean drive \(\mu\) (dimensionless). Default 0.0.

  • g (float or array_like, optional) – Gain parameter \(g\) of the quartic nonlinearity (dimensionless). Larger values steepen the gain curve and shift the half-activation point. Must be positive. Default 1.0.

  • mult_coupling (bool, optional) – Multiplicative coupling flag kept for NEST compatibility. For this model variant, multiplicative factors are identically one regardless of this setting. Default False.

  • linear_summation (bool, optional) – If True (default), apply gain \(\phi\) to total summed synaptic input. If False, apply \(\phi\) to each event before weighted summation (per-event nonlinearity mode). Default True.

  • rectify_rate (float or array_like, optional) – Lower bound for rectified output when rectify_output=True. Must be non-negative. Default 0.0.

  • rectify_output (bool, optional) – If True, clamp updated rate to \(\ge\) rectify_rate at each step. Default False.

  • rate_initializer (Callable[[shape, batch_size], Array], optional) – Initializer for rate state. Default Constant(0.0).

  • noise_initializer (Callable[[shape, batch_size], Array], optional) – Initializer for noise state. Default Constant(0.0).

  • name (str, optional) – Module name for identification. Auto-generated if not provided.

State Variables

rateShortTermState

Current neuron rate \(X(t)\) (dimensionless, shape varshape + (batch_size,)).

noiseShortTermState

Last noise realization \(\sigma\,\xi_n\) (dimensionless).

instant_rateShortTermState

Instantaneous outgoing rate (alias of rate after update).

delayed_rateShortTermState

Delayed outgoing rate (stored from previous step).

_step_countShortTermState

Internal step counter (int64 scalar) for delayed event scheduling.

Parameter Mapping

brainpy.state parameter

NEST parameter

Notes

tau

tau

Time constant (ms)

lambda_

lambda

Passive decay rate

sigma

sigma

Input noise amplitude

mu

mu

Constant drive

g

g

Gain parameter

mult_coupling

mult_coupling

(Always 1.0 for this model)

linear_summation

linear_summation

Gain application mode

rectify_rate

rectify_rate

Lower rectification bound

rectify_output

rectify_output

Rectification flag

rate_initializer

rate (initialization)

Initial rate value

Recordables

  • rate : Current neuron rate (main output)

  • noise : Last noise realization

Receptor Types

  • RATE : index 0 (single receptor port for all rate inputs)

Notes

Runtime event API:

  • instant_rate_events: Applied in the current step with delay_steps=0. Raises ValueError if non-zero delay is specified.

  • delayed_rate_events: Queued for delivery after delay_steps steps (default delay_steps=1 if omitted).

Event format flexibility:

  • Dict: {'rate': r, 'weight': w, 'delay_steps': d, 'multiplicity': m} (all fields optional except rate).

  • Tuple: (rate, weight), (rate, weight, delay_steps), or (rate, weight, delay_steps, multiplicity).

  • Scalar: Interpreted as rate with weight=1, delay_steps=0, multiplicity=1.

  • Lists of any of the above are flattened and processed sequentially.

Weight polarity: Positive weights contribute to excitatory branch, negative to inhibitory branch. Branch separation only affects linear_summation=False mode with mult_coupling=True (which has no effect for this model).

Examples

Create a population and drive it with noisy input:

>>> import brainpy.state as bst
>>> import saiunit as u
>>> import brainstate as bs
>>> pop = bst.sigmoid_rate_gg_1998_ipn(
...     in_size=100, tau=20*u.ms, lambda_=0.5, sigma=0.1, g=2.0
... )
>>> pop.init_all_states()
>>> with bs.environ.context(dt=0.1*u.ms):
...     for _ in range(1000):
...         r = pop.update(x=0.5)

Apply delayed rate events:

>>> with bs.environ.context(dt=0.1*u.ms):
...     # Event at t+5 steps with weight 0.8
...     r = pop.update(delayed_rate_events=[{'rate': 1.0, 'weight': 0.8, 'delay_steps': 5}])

References

See also

sigmoid_rate_ipn

Standard sigmoid gain function

lin_rate_ipn

Linear rate neuron variant

tanh_rate_ipn

Hyperbolic tangent gain function

init_state(**kwargs)[source]#

Initialize neuron state variables and delayed event queues.

Allocates rate, noise, instant_rate, delayed_rate, internal step counter, and per-step delayed event dictionaries for excitatory and inhibitory branches.

Parameters:

**kwargs – Unused compatibility parameters accepted by the base-state API.

Notes

Called automatically by init_all_states(). Initializes:

  • rate : from rate_initializer

  • noise : from noise_initializer

  • instant_rate, delayed_rate : copies of initial rate

  • _step_count : int64 scalar starting at 0

  • _delayed_ex_queue, _delayed_in_queue : empty dicts

property receptor_types#

Receptor port name-to-index mapping for synaptic input routing.

Returns:

{'RATE': 0} — single receptor port accepting all rate events.

Return type:

dict[str, int]

property recordables#

List of state variables available for recording.

Returns:

['rate', 'noise'] — current rate and last noise realization.

Return type:

list of str

update(x=0.0, instant_rate_events=None, delayed_rate_events=None, noise=None, _precomputed_ex=None, _precomputed_in=None)[source]#

Advance rate neuron dynamics by one time step with stochastic integration.

Implements the full update cycle: drain delayed events, schedule new delayed events, aggregate instantaneous events and external inputs, propagate intrinsic dynamics with stochastic exponential Euler, apply quartic gain function, and apply optional rectification.

Parameters:
  • x (float or array_like, optional) – External continuous current input (dimensionless). Broadcasts to varshape. Aggregated via sum_current_inputs(). Default 0.0.

  • instant_rate_events (None or list or dict or tuple, optional) – Instantaneous rate events applied in the current step. Each event must have delay_steps=0 or omit the field. Supports nested lists, dicts, tuples, or scalars. Default None (no instantaneous events).

  • delayed_rate_events (None or list or dict or tuple, optional) – Delayed rate events scheduled for future delivery. Each event specifies delay_steps >= 0 (default 1 if omitted). Format matches instant_rate_events. Default None (no delayed events).

  • noise (float or array_like, optional) – External noise realization \(\xi_n\) to override internal random draw. If provided, broadcasts to varshape. If None (default), draws \(\xi_n \sim \mathcal{N}(0, 1)\) internally.

Returns:

rate_new – Updated rate \(X_{n+1}\) (shape varshape or varshape + (batch,)).

Return type:

ndarray

Raises:
  • ValueError – If instant_rate_events contain non-zero delay_steps.

  • ValueError – If delayed_rate_events contain negative delay_steps.

  • ValueError – If event tuples have unsupported length (must be 2, 3, or 4).

Notes

Computational sequence:

  1. Convert time step to milliseconds: \(h = dt\).

  2. Broadcast parameters (tau, sigma, mu, g, lambda_, rectify_rate) to state_shape.

  3. Drain delayed queues for current step index, schedule new delayed events from delayed_rate_events.

  4. Accumulate instant_rate_events and delta inputs, separating by weight polarity (excitatory/inhibitory).

  5. Aggregate external input x via sum_current_inputs().

  6. Compute propagators \(P_1\), \(P_2\), and noise factor based on \(\lambda\).

  7. Draw or use provided noise \(\xi_n\).

  8. Propagate \(X_{n+1} = P_1 X_n + P_2 (\mu + \mu_{ext}) + \text{noise_factor} \cdot \sigma \xi_n\).

  9. Apply gain \(\phi\) to synaptic inputs (mode depends on linear_summation and mult_coupling).

  10. Add weighted synaptic contributions to \(X_{n+1}\).

  11. Apply rectification if rectify_output=True.

  12. Update state variables and increment step counter.

Gain application modes:

  • linear_summation=True, mult_coupling=False (default): \(\phi(h_{ex,\mathrm{inst}} + h_{in,\mathrm{inst}} + h_{ex,\mathrm{del}} + h_{in,\mathrm{del}})\).

  • linear_summation=False: Gain already applied per event before summation.

  • mult_coupling=True: Separate excitatory/inhibitory branches with multiplicative factors (always 1.0 for this model).

Delayed event scheduling: Events with delay_steps=d are delivered at global step current_step + d. Zero-delay events in delayed_rate_events are applied immediately (no queueing).

Random number generation: Uses NumPy’s default RNG (np.random.normal). For reproducibility, seed the global RNG before simulation.