WilsonCowanLinearStep#
- class brainmass.WilsonCowanLinearStep(in_size, tau_E=Quantity(1., 'ms'), tau_I=Quantity(1., 'ms'), wEE=0.8, wIE=0.3, wEI=1.0, wII=0.85, r=1.0, noise_E=None, noise_I=None, rE_init=Constant(value=0.0), rI_init=Constant(value=0.0), method='exp_euler')#
Wilson-Cowan neural mass model with linear (ReLU) transfer function.
This variant of the Wilson-Cowan model replaces the sigmoidal transfer function with a rectified linear unit (ReLU) function: [x]+ = max(0, x). This removes the need for sigmoid gain and threshold parameters, simplifies the computational graph, and can be more gradient-friendly for optimization tasks.
- Parameters:
in_size (
int|Sequence[int] |integer|Sequence[integer]) – Spatial shape of each population (E and I). Can be an int, a tuple of ints, or any size compatible withbrainstate.tau_E (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Excitatory time constant with unit of time (e.g.,1. * u.ms). Broadcastable toin_size. Default is1. * u.ms.tau_I (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Inhibitory time constant with unit of time (e.g.,1. * u.ms). Broadcastable toin_size. Default is1. * u.ms.wEE (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – E->E coupling strength (dimensionless). Broadcastable toin_size. Default is0.8.wIE (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – E->I coupling strength (dimensionless). Broadcastable toin_size. Default is0.3.wEI (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – I->E coupling strength (dimensionless). Broadcastable toin_size. Default is1.0.wII (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – I->I coupling strength (dimensionless). Broadcastable toin_size. Default is0.85.r (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Refractory parameter (dimensionless) that limits maximum activation. Broadcastable toin_size. Default is1..noise_E (
Noise) – Additive noise process for the excitatory population. If provided, its output is added torE_inpat each update. Default isNone.noise_I (
Noise) – Additive noise process for the inhibitory population. If provided, its output is added torI_inpat each update. Default isNone.rE_init (
Callable) – Parameter for the excitatory staterE. Default isbraintools.init.Constant(0.0).rI_init (
Callable) – Parameter for the inhibitory staterI. Default isbraintools.init.Constant(0.0).method (
str) – The numerical integration method to use. One of'exp_euler','euler','rk2', or'rk4', that is implemented inbraintools.quad. Default is'exp_euler'.
- Return type:
Any
- rE#
Excitatory population activity (dimensionless). Shape equals
(batch?,) + in_sizeafterinit_state.- Type:
brainstate.HiddenState
- rI#
Inhibitory population activity (dimensionless). Shape equals
(batch?,) + in_sizeafterinit_state.- Type:
brainstate.HiddenState
Notes
The continuous-time Wilson-Cowan equations with ReLU transfer are
\[\tau_E \frac{dr_E}{dt} = -r_E(t) + \bigl[1 - r\, r_E(t)\bigr] \bigl[w_{EE} r_E(t) - w_{EI} r_I(t) + I_E(t)\bigr]_+,\]\[\tau_I \frac{dr_I}{dt} = -r_I(t) + \bigl[1 - r\, r_I(t)\bigr] \bigl[w_{IE} r_E(t) - w_{II} r_I(t) + I_I(t)\bigr]_+,\]where \([x]_+ = \max(0, x)\) is the rectified linear unit.
Comparison to standard Wilson-Cowan:
ReLU transfer function instead of sigmoid
Removed sigmoid parameters: a_E, a_I, theta_E, theta_I
Reduces parameter space from 11 to 7 parameters
Simpler computational graph, faster evaluation
More gradient-friendly for optimization
Important: Default weights are scaled down by ~13-15x for stability
References
Wilson, H. R., & Cowan, J. D. (1972). Excitatory and inhibitory interactions in localized populations of model neurons. Biophysical Journal, 12, 1–24.
Examples
>>> import brainmass >>> import brainstate >>> import brainunit as u >>> brainstate.environ.set(dt=0.1 * u.ms) >>> model = brainmass.WilsonCowanLinearStep(1) >>> _ = model.init_all_states() >>> out = model.update(rE_inp=0.5) >>> out.shape (1,)
- __init__(in_size, tau_E=Quantity(1., 'ms'), tau_I=Quantity(1., 'ms'), wEE=0.8, wIE=0.3, wEI=1.0, wII=0.85, r=1.0, noise_E=None, noise_I=None, rE_init=Constant(value=0.0), rI_init=Constant(value=0.0), method='exp_euler')[source]#
- Parameters:
tau_E (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
tau_I (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
wEE (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
wIE (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
wEI (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
wII (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
r (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | Param)
noise_E (Noise)
noise_I (Noise)
rE_init (Callable)
rI_init (Callable)
method (str)
- drE(rE, rI, ext)[source]#
Right-hand side for the excitatory population.
Must be implemented by subclasses.
- Parameters:
rE (array-like) – Excitatory activity (dimensionless).
rI (array-like) – Inhibitory activity (dimensionless), broadcastable to
rE.ext (array-like or scalar) – External input to E.
- Returns:
Time derivative
drE/dtwith unit of1/time.- Return type:
array-like
- drI(rI, rE, ext)[source]#
Right-hand side for the inhibitory population.
Must be implemented by subclasses.
- Parameters:
rI (array-like) – Inhibitory activity (dimensionless).
rE (array-like) – Excitatory activity (dimensionless), broadcastable to
rI.ext (array-like or scalar) – External input to I.
- Returns:
Time derivative
drI/dtwith unit of1/time.- Return type:
array-like