# IntegratorFunctions¶

Functions that integrate current value of input with previous value.

class psyneulink.core.components.functions.statefulfunctions.integratorfunctions.SimpleIntegrator(default_variable=None, rate=1.0, noise=0.0, offset=0.0, initializer=None, params=None, owner=None, prefs=None)

function returns:

$previous_value + rate * variable + noise + offset$

Modulatory Parameters:

MULTIPLICATIVE_PARAM: rate
ADDITIVE_PARAM: offset

Parameters
• default_variable (number, list or array : default class_defaults.variable) – specifies a template for the value to be integrated; if it is a list or array, each element is independently integrated.

• rate (float, list or 1d array : default 1.0) – specifies the rate of integration; if it is a list or array, it must be the same length as variable (see rate for details).

• noise (float, function, list or 1d array : default 0.0) – specifies random value added to integral in each call to function; if it is a list or array, it must be the same length as variable (see noise for details).

• offset (float, list or 1d array : default 0.0) – specifies constant value added to integral in each call to function; if it is a list or array, it must be the same length as variable (see offset for details).

• initializer (float, list or 1d array : default 0.0) – specifies starting value(s) for integration; if it is a list or array, it must be the same length as default_variable (see initializer for details).

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

• owner (Component) – component to which to assign the Function.

• name (str : default see name) – specifies the name of the Function.

• prefs (PreferenceSet or specification dict : default Function.classPreferences) – specifies the PreferenceSet for the Function (see prefs for details).

variable

current input value some portion of which (determined by rate) will be added to the prior value; if it is an array, each element is independently integrated.

Type

number or array

rate

determines the rate of integration. If it is a float or has a single element, it is applied to all elements of variable; if it has more than one element, each element is applied to the corresponding element of variable. Serves as MULTIPLICATIVE_PARAM for modulation of function.

Type

float or 1d array

noise

random value added to integral in each call to function (see noise for details).

Type

float, Function or 1d array

offset

constant value added to integral in each call to function. If variable is an array and offset is a float, offset is applied to each element of the integral; if offset is a list or array, each of its elements is applied to each of the corresponding elements of the integral (i.e., Hadamard addition). Serves as ADDITIVE_PARAM for modulation of function.

Type

float or 1d array

initializer

determines the starting value(s) for integration (i.e., the value to which previous_value is set (see initializer for details).

Type

float or 1d array

previous_value

stores previous value with which variable is integrated.

Type

1d array : default class_defaults.variable

owner

component to which the Function has been assigned.

Type

Component

name

the name of the Function; if it is not specified in the name argument of the constructor, a default is assigned by FunctionRegistry (see Naming for conventions used for default and duplicate names).

Type

str

prefs

the PreferenceSet for function; if it is not specified in the prefs argument of the Function’s constructor, a default is assigned using classPreferences defined in __init__.py (see Preferences for details).

Type

PreferenceSet or specification dict : Function.classPreferences

_function(variable=None, context=None, params=None)
Parameters
• variable (number, list or array : default class_defaults.variable) – a single value or array of values to be integrated.

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

Returns

updated value of integral

Return type

2d array

class psyneulink.core.components.functions.statefulfunctions.integratorfunctions.AdaptiveIntegrator(default_variable=None, rate=1.0, noise=0.0, offset=0.0, initializer=None, params=None, owner=None, prefs=None)

function returns exponentially weighted moving average (EWMA) of input:

$((1-rate) * previous_value) + (rate * variable) + noise + offset$

Modulatory Parameters:

MULTIPLICATIVE_PARAM: rate
ADDITIVE_PARAM: offset

Parameters
• default_variable (number, list or array : default class_defaults.variable) – specifies a template for the value to be integrated; if it is a list or array, each element is independently integrated.

• rate (float, list or 1d array : default 1.0) – specifies the smoothing factor of the EWMA. If it is a list or array, it must be the same length as variable (see rate for details).

• noise (float, function, list or 1d array : default 0.0) – specifies random value added to integral in each call to function; if it is a list or array, it must be the same length as variable (see noise for details).

• offset (float, list or 1d array : default 0.0) – specifies constant value added to integral in each call to function; if it is a list or array, it must be the same length as variable (see offset for details).

• initializer (float, list or 1d array : default 0.0) – specifies starting value(s) for integration. If it is a list or array, it must be the same length as default_variable (see initializer for details).

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

• owner (Component) – component to which to assign the Function.

• name (str : default see name) – specifies the name of the Function.

• prefs (PreferenceSet or specification dict : default Function.classPreferences) – specifies the PreferenceSet for the Function (see prefs for details).

variable

current input value some portion of which (determined by rate) will be added to the prior value; if it is an array, each element is independently integrated.

Type

number or array

rate

determines the smoothing factor of the EWMA. All rate elements must be between 0 and 1 (rate = 0 –> no change, variable is ignored; rate = 1 –> previous_value is ignored). If rate is a float or has a single element, its value is applied to all elements of variable and previous_value; if it is an array, each element is applied to the corresponding element of variable and previous_value). Serves as MULTIPLICATIVE_PARAM for modulation of function.

Type

float or 1d array

noise

random value added to integral in each call to function (see noise for details).

Type

float, Function or 1d array

offset

constant value added to integral in each call to function. If variable is a list or array and offset is a float, offset is applied to each element of the integral; if offset is a list or array, each of its elements is applied to each of the corresponding elements of the integral (i.e., Hadamard addition). Serves as ADDITIVE_PARAM for modulation of function.

Type

float or 1d array

initializer

determines the starting value(s) for integration (i.e., the value(s) to which previous_value is set (see initializer for details).

Type

float or 1d array

previous_value

stores previous value with which variable is integrated.

Type

1d array : default class_defaults.variable

owner

component to which the Function has been assigned.

Type

Component

name

the name of the Function; if it is not specified in the name argument of the constructor, a default is assigned by FunctionRegistry (see Naming for conventions used for default and duplicate names).

Type

str

prefs

the PreferenceSet for function; if it is not specified in the prefs argument of the Function’s constructor, a default is assigned using classPreferences defined in __init__.py (see Preferences for details).

Type

PreferenceSet or specification dict : Function.classPreferences

_validate_params(request_set, target_set=None, context=None)

Check inner dimension (length) of all parameters used for the function

Insure that for any parameters that are in the Paramaters class, designated as function_arg, and

specified by the user with length>1: 1) they all have the same length; 2) if default_variable:

• was specified by the user, the parameters all have the same length as that

• was NOT specified by the user, they all have the same length as each other; note: in this case, default_variable will be set to the length of those parameters in

_instantiate_attributes_before_function below

_function(variable=None, context=None, params=None)
Parameters
• variable (number, list or array : default class_defaults.variable) – a single value or array of values to be integrated.

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

Returns

updated value of integral

Return type

ndarray (dimension equal to variable)

class psyneulink.core.components.functions.statefulfunctions.integratorfunctions.DriftDiffusionIntegrator(default_variable=None, rate=1.0, noise=0.0, offset= 0.0, starting_point=0.0, threshold=1.0 time_step_size=1.0, initializer=None, params=None, owner=None, prefs=None)

Accumulate “evidence” to a bound. function returns one time step of integration:

$previous\_value + rate \cdot variable \cdot time\_step\_size + \mathcal{N}(\sigma^2)$

where

$\sigma^2 =\sqrt{time\_step\_size \cdot noise}$

Modulatory Parameters:

MULTIPLICATIVE_PARAM: rate
ADDITIVE_PARAM: offset

Parameters
• default_variable (number, list or array : default class_defaults.variable) – specifies the stimulus component of drift rate – the drift rate is the product of variable and rate

• rate (float, list or 1d array : default 1.0) – applied multiplicatively to variable; If it is a list or array, it must be the same length as variable (see rate for details).

• noise (float : default 0.0) – specifies a value by which to scale the normally distributed random value added to the integral in each call to function (see noise for details).

• offset (float, list or 1d array : default 0.0) – specifies constant value added to integral in each call to function if it’s absolute value is below threshold; if it is a list or array, it must be the same length as variable (see offset for details).

• starting_point (float, list or 1d array: default 0.0) – specifies the starting value for the integration process; if it is a list or array, it must be the same length as variable (see starting_point for details).

• threshold (float : default 0.0) – specifies the threshold (boundaries) of the drift diffusion process – i.e., at which the integration process terminates (see threshold for details).

• time_step_size (float : default 0.0) – specifies the timing precision of the integration process (see time_step_size for details.

• initializer (float, list or 1d array : default 0.0) – specifies starting value(s) for integration. If it is a list or array, it must be the same length as default_variable (see initializer for details).

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

• owner (Component) – component to which to assign the Function.

• name (str : default see name) – specifies the name of the Function.

• prefs (PreferenceSet or specification dict : default Function.classPreferences) – specifies the PreferenceSet for the Function (see prefs for details).

variable

current input value (can be thought of as implementing the stimulus component of the drift rate); if it is an array, each element represents an independently integrated decision variable.

Type

float or array

rate

applied multiplicatively to variable (can be thought of as implementing the attentional component of the drift rate). If it is a float or has a single element, its value is applied to all the elements of variable; if it is an array, each element is applied to the corresponding element of variable. Serves as MULTIPLICATIVE_PARAM for modulation of function.

Type

float or 1d array

random_state

private pseudorandom number generator

Type

numpy.RandomState

noise

scales the normally distributed random value added to integral in each call to function. If variable is a list or array, and noise is a float, a single random term is generated and applied for each element of variable. If noise is a list or array, it must be the same length as variable, and a separate random term scaled by noise is applied for each of the corresponding elements of variable.

Type

float or 1d array

_function(variable=None, context=None, params=None)
Parameters
• variable (number, list or array : default class_defaults.variable) – a single value or array of values to be integrated (can be thought of as the stimulus component of the drift rate).

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

Returns

updated value of integral

Return type

2d array

reset(previous_value=None, previous_time=None, context=None)

Resets value and previous_value to the specified value(s).

If arguments are passed into the reset method, then reset sets each of the attributes in stateful_attributes to the value of the corresponding argument. Next, it sets the value to a list containing each of the argument values.

If reset is called without arguments, then it sets each of the attributes in stateful_attributes to the value of the corresponding attribute in initializers. Next, it sets the value to a list containing the values of each of the attributes in initializers.

Often, the only attribute in stateful_attributes is previous_value and the only attribute in initializers is initializer, in which case the reset method sets previous_value and value to either the value of the argument (if an argument was passed into reset) or the current value of initializer.

For specific types of StatefulFunction functions, the reset method may carry out other reinitialization steps.

class psyneulink.core.components.functions.statefulfunctions.integratorfunctions.OrnsteinUhlenbeckIntegrator(default_variable=None, rate=1.0, decay=1.0, noise=0.0, offset=0.0, starting_point=0.0, time_step_size=1.0, initializer=0.0, params=None, owner=None, prefs=None)

function returns one time step of integration according to an Ornstein Uhlenbeck process:

$previous\_value + (decay \cdot previous\_value) - (rate \cdot variable) + \mathcal{N}(\sigma^2)$

where .. math:

\sigma^2 =\sqrt{time\_step\_size \cdot noise}


Modulatory Parameters:

MULTIPLICATIVE_PARAM: rate
ADDITIVE_PARAM: offset

Parameters
• default_variable (number, list or array : default class_defaults.variable) – specifies a template for the stimulus component of drift rate – the drift rate is the product of variable and rate

• rate (float, list or 1d array : default 1.0) – specifies value applied multiplicatively to variable; If it is a list or array, it must be the same length as variable (see rate for details).

• decay (float, list or 1d array : default 1.0) – specifies value applied multiplicatively to previous_value; If it is a list or array, it must be the same length as variable ( see decay for details).

• noise (float : default 0.0) – specifies a value by which to scale the normally distributed random value added to the integral in each call to function (see noise for details).

• offset (float, list or 1d array : default 0.0) – specifies a constant value added to integral in each call to function; if it is a list or array, it must be the same length as variable (see offset for details)

• starting_point (float : default 0.0) – specifies the starting time of the model and is used to compute previous_time

• time_step_size (float : default 0.0) – determines the timing precision of the integration process (see time_step_size for details.

• initializer (float, list or 1d array : default 0.0) – specifies starting value(s) for integration. If it is a list or array, it must be the same length as default_variable (see initializer for details).

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

• owner (Component) – component to which to assign the Function.

• name (str : default see name) – specifies the name of the Function.

• prefs (PreferenceSet or specification dict : default Function.classPreferences) – specifies the PreferenceSet for the Function (see prefs for details).

variable

represents the stimulus component of drift. The product of variable and rate is multiplied by time_step_size to model the accumulation of evidence during one step.

Type

number or array

rate

applied multiplicatively to variable. If it is a float or has a single element, its value is applied to all the elements of variable; if it is an array, each element is applied to the corresponding element of variable. Serves as MULTIPLICATIVE_PARAM for modulation of function.

Type

float or 1d array

decay

applied multiplicatively to previous_value; If it is a float or has a single element, its value is applied to all the elements of previous_value; if it is an array, each element is applied to the corresponding element of previous_value.

Type

float or 1d array

noise

scales the normally distributed random value added to integral in each call to function. A single random term is generated each execution, and applied to all elements of variable if that is an array with more than one element.

Type

float

offset

constant value added to integral in each call to function. If variable is an array and offset is a float, offset is applied to each element of the integral; if offset is a list or array, each of its elements is applied to each of the corresponding elements of the integral (i.e., Hadamard addition). Serves as ADDITIVE_PARAM for modulation of function.

Type

float or 1d array

starting_point

determines the start time of the integration process.

Type

float

time_step_size

determines the timing precision of the integration process and is used to scale the noise parameter appropriately.

Type

float

initializer

determines the starting value(s) for integration (i.e., the value(s) to which previous_value is set (see initializer for details).

Type

float or 1d array

previous_value

stores previous value with which variable is integrated.

Type

1d array : default class_defaults.variable

previous_time

stores previous time at which the function was executed and accumulates with each execution according to time_step_size.

Type

float

random_state

private pseudorandom number generator

Type

numpy.RandomState

owner

component to which the Function has been assigned.

Type

Component

name

the name of the Function; if it is not specified in the name argument of the constructor, a default is assigned by FunctionRegistry (see Naming for conventions used for default and duplicate names).

Type

str

prefs

the PreferenceSet for function; if it is not specified in the prefs argument of the Function’s constructor, a default is assigned using classPreferences defined in __init__.py (see Preferences for details).

Type

PreferenceSet or specification dict : Function.classPreferences

_function(variable=None, context=None, params=None)
Parameters
• variable (number, list or array : default class_defaults.variable) – a single value or array of values to be integrated.

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

Returns

updated value of integral

Return type

2d array

reset(previous_value=None, previous_time=None, context=None)

Resets value and previous_value to the specified value(s).

If arguments are passed into the reset method, then reset sets each of the attributes in stateful_attributes to the value of the corresponding argument. Next, it sets the value to a list containing each of the argument values.

If reset is called without arguments, then it sets each of the attributes in stateful_attributes to the value of the corresponding attribute in initializers. Next, it sets the value to a list containing the values of each of the attributes in initializers.

Often, the only attribute in stateful_attributes is previous_value and the only attribute in initializers is initializer, in which case the reset method sets previous_value and value to either the value of the argument (if an argument was passed into reset) or the current value of initializer.

For specific types of StatefulFunction functions, the reset method may carry out other reinitialization steps.

class psyneulink.core.components.functions.statefulfunctions.integratorfunctions.FitzHughNagumoIntegrator(default_variable=1.0, initial_w=0.0, initial_v=0.0, time_step_size=0.05, t_0=0.0, a_v=-1/3, b_v=0.0, c_v=1.0, d_v=0.0, e_v=-1.0, f_v=1.0, threshold=-1.0 time_constant_v=1.0, a_w=1.0, b_w=-0.8, c_w=0.7, mode=1.0, uncorrelated_activity=0.0 time_constant_w = 12.5, integration_method="RK4" params=None, owner=None, prefs=None)

function returns one time step of integration of the Fitzhugh-Nagumo model https://en.wikipedia.org/wiki/FitzHugh–Nagumo_model>_ of an excitable oscillator:

$time\_constant_v \frac{dv}{dt} = a_v * v^3 + (1 + threshold) * b_v * v^2 + (- threshold) * c_v * v^2 + d_v + e_v * w + f_v * I_{ext}$

where .. math:

time\_constant_w * \frac{dw}{dt} = mode * a_w * v + b_w * w +c_w + (1 - mode) * uncorrelated\_activity


Either Euler or Dormand–Prince (4th Order Runge-Kutta) methods of numerical integration can be used.

The FitzHughNagumoIntegrator implements all of the parameters of the FitzHughNagumo model; however, not all combinations of these are sensible. Typically, they are combined into two sets. These are described below, followed by a describption of how they are used to implement three common variants of the model with the FitzHughNagumoIntegrator.

Fast, Excitatory Variable:

$\frac{dv}{dt} = \frac{a_v v^{3} + b_v v^{2} (1+threshold) - c_v v\, threshold + d_v + e_v\, previous_w + f_v\, variable)}{time\, constant_v}$

Slow, Inactivating Variable:

$\frac{dw}{dt} = \frac{a_w\, mode\, previous_v + b_w w + c_w + uncorrelated\,activity\,(1-mode)}{time\, constant_w}$
1. Fitzhugh-Nagumo Model

Fast, Excitatory Variable:

$\frac{dv}{dt} = v - \frac{v^3}{3} - w + I_{ext}$

Slow, Inactivating Variable:

$\frac{dw}{dt} = \frac{v + a - bw}{T}$

$$\frac{dw}{dt}$$ often has the following parameter values:

$\frac{dw}{dt} = 0.08\,(v + 0.7 - 0.8 w)$

Implementation in FitzHughNagumoIntegrator

The default values implement the above equations.

2. Modified FitzHughNagumo Model

Fast, Excitatory Variable:

$\frac{dv}{dt} = v(a-v)(v-1) - w + I_{ext}$

Slow, Inactivating Variable:

$\frac{dw}{dt} = bv - cw$

Mahbub Khan (2013) provides a nice summary of why this formulation is useful.

Implementation in FitzHughNagumoIntegrator

The following parameter values must be specified in the equation for $$\frac{dv}{dt}$$:

When the parameters above are set to the listed values, the FitzHughNagumoIntegrator equation for $$\frac{dv}{dt}$$ reduces to the Modified FitzHughNagumo formulation, and the remaining parameters in the $$\frac{dv}{dt}$$ equation correspond as follows:

Te following parameter values must be set in the equation for $$\frac{dw}{dt}$$:

+—————————-+—–+——+- —————+———————–+ |FitzHughNagumoIntegrator Parameter |c_w | mode | time_constant_w | uncorrelated_activity | +—————————-+—–+——+- —————+———————–+ |Value | 0.0 | 1.0 | 1.0 | 0.0 | +—————————-+—–+——+- —————+———————–+

When the parameters above are set to the listed values, the FitzHughNagumoIntegrator equation for $$\frac{dw}{dt}$$ reduces to the Modified FitzHughNagumo formulation, and the remaining parameters in the $$\frac{dw}{dt}$$ equation correspond as follows:

3. Modified FitzHughNagumo Model as implemented in Gilzenrat (2002)

Fast, Excitatory Variable:

[Eq. (6) in Gilzenrat (2002) ]

$\tau_v \frac{dv}{dt} = v(a-v)(v-1) - u + w_{vX_1}\, f(X_1)$

Slow, Inactivating Variable:

[Eq. (7) & Eq. (8) in Gilzenrat (2002) ]

$\tau_u \frac{du}{dt} = Cv + (1-C)\, d - u$

Implementation in FitzHughNagumoIntegrator

The following FitzHughNagumoIntegrator parameter values must be set in the equation for $$\frac{dv}{dt}$$:

When the parameters above are set to the listed values, the FitzHughNagumoIntegrator equation for $$\frac{dv}{dt}$$ reduces to the Gilzenrat formulation, and the remaining parameters in the $$\frac{dv}{dt}$$ equation correspond as follows:

The following FitzHughNagumoIntegrator parameter values must be set in the equation for $$\frac{dw}{dt}$$:

When the parameters above are set to the listed values, the FitzHughNagumoIntegrator equation for $$\frac{dw}{dt}$$ reduces to the Gilzenrat formulation, and the remaining parameters in the $$\frac{dw}{dt}$$ equation correspond as follows:

Parameters
• default_variable (number, list or array : default class_defaults.variable) – specifies a template for the external stimulus

• initial_w (float, list or 1d array : default 0.0) – specifies starting value for integration of dw/dt. If it is a list or array, it must be the same length as default_variable

• initial_v (float, list or 1d array : default 0.0) – specifies starting value for integration of dv/dt. If it is a list or array, it must be the same length as default_variable

• time_step_size (float : default 0.1) – specifies the time step size of numerical integration

• t_0 (float : default 0.0) – specifies starting value for time

• a_v (float : default -1/3) – coefficient on the v^3 term of the dv/dt equation

• b_v (float : default 0.0) – coefficient on the v^2 term of the dv/dt equation

• c_v (float : default 1.0) – coefficient on the v term of the dv/dt equation

• d_v (float : default 0.0) – constant term in the dv/dt equation

• e_v (float : default -1.0) – coefficient on the w term in the dv/dt equation

• f_v (float : default 1.0) – coefficient on the external stimulus (variable) term in the dv/dt equation

• time_constant_v (float : default 1.0) – scaling factor on the dv/dt equation

• a_w (float : default 1.0,) – coefficient on the v term of the dw/dt equation

• b_w (float : default -0.8,) – coefficient on the w term of the dv/dt equation

• c_w (float : default 0.7,) – constant term in the dw/dt equation

• threshold (float : default -1.0) – specifies a value of the input below which the LC will tend not to respond and above which it will

• mode (float : default 1.0) – coefficient which simulates electrotonic coupling by scaling the values of dw/dt such that the v term (representing the input from the LC) increases when the uncorrelated_activity term (representing baseline activity) decreases

• uncorrelated_activity (float : default 0.0) – constant term in the dw/dt equation

• time_constant_w (float : default 12.5) – scaling factor on the dv/dt equation

• integration_method (str : default "RK4") – selects the numerical integration method. Currently, the choices are: “RK4” (4th Order Runge-Kutta) or “EULER” (Forward Euler)

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

• owner (Component) – component to which to assign the Function.

• name (str : default see name) – specifies the name of the Function.

• prefs (PreferenceSet or specification dict : default Function.classPreferences) – specifies the PreferenceSet for the Function (see prefs for details).

variable

External stimulus

Type

number or array

previous_v

stores accumulated value of v during integration

Type

1d array : default class_defaults.variable

previous_w

stores accumulated value of w during integration

Type

1d array : default class_defaults.variable

previous_t

stores accumulated value of time, which is incremented by time_step_size on each execution of the function

Type

float

owner

component to which the Function has been assigned.

Type

Component

initial_w

specifies starting value for integration of dw/dt. If it is a list or array, it must be the same length as default_variable

Type

float, list or 1d array : default 0.0

initial_v

specifies starting value for integration of dv/dt. If it is a list or array, it must be the same length as default_variable

Type

float, list or 1d array : default 0.0

time_step_size

specifies the time step size of numerical integration

Type

float : default 0.1

t_0

specifies starting value for time

Type

float : default 0.0

a_v

coefficient on the v^3 term of the dv/dt equation

Type

float : default -1/3

b_v

coefficient on the v^2 term of the dv/dt equation

Type

float : default 0.0

c_v

coefficient on the v term of the dv/dt equation

Type

float : default 1.0

d_v

constant term in the dv/dt equation

Type

float : default 0.0

e_v

coefficient on the w term in the dv/dt equation

Type

float : default -1.0

f_v

coefficient on the external stimulus (variable) term in the dv/dt equation

Type

float : default 1.0

time_constant_v

scaling factor on the dv/dt equation

Type

float : default 1.0

a_w

coefficient on the v term of the dw/dt equation

Type

float : default 1.0

b_w

coefficient on the w term of the dv/dt equation

Type

float : default -0.8

c_w

constant term in the dw/dt equation

Type

float : default 0.7

threshold

coefficient that scales both the v^2 [ (1+threshold)*v^2 ] and v [ (-threshold)*v ] terms in the dv/dt equation under a specific formulation of the FitzHughNagumo equations, the threshold parameter behaves as a “threshold of excitation”, and has the following relationship with variable (the external stimulus):

• when the external stimulus is below the threshold of excitation, the system is either in a stable state, or will emit a single excitation spike, then reach a stable state. The behavior varies depending on the magnitude of the difference between the threshold and the stimulus.

• when the external stimulus is equal to or above the threshold of excitation, the system is unstable, and will emit many excitation spikes

• when the external stimulus is too far above the threshold of excitation, the system will emit some excitation spikes before reaching a stable state.

Type

float : default -1.0

mode

coefficient which simulates electrotonic coupling by scaling the values of dw/dt such that the v term (representing the input from the LC) increases when the uncorrelated_activity term (representing baseline activity) decreases

Type

float : default 1.0

uncorrelated_activity

constant term in the dw/dt equation

Type

float : default 0.0

time_constant_w

scaling factor on the dv/dt equation

Type

float : default 12.5

prefs

the PreferenceSet for the Function (see prefs for details).

Type

PreferenceSet or specification dict : default Function.classPreferences

_validate_params(request_set, target_set=None, context=None)

Check inner dimension (length) of all parameters used for the function

Insure that for any parameters that are in the Paramaters class, designated as function_arg, and

specified by the user with length>1: 1) they all have the same length; 2) if default_variable:

• was specified by the user, the parameters all have the same length as that

• was NOT specified by the user, they all have the same length as each other; note: in this case, default_variable will be set to the length of those parameters in

_instantiate_attributes_before_function below

_function(variable=None, context=None, params=None)
Parameters

params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

Returns

current value of v , current value of w

Return type

float, list, or array

reset(previous_v=None, previous_w=None, previous_time=None, context=None)

Resets value and previous_value to the specified value(s).

If arguments are passed into the reset method, then reset sets each of the attributes in stateful_attributes to the value of the corresponding argument. Next, it sets the value to a list containing each of the argument values.

If reset is called without arguments, then it sets each of the attributes in stateful_attributes to the value of the corresponding attribute in initializers. Next, it sets the value to a list containing the values of each of the attributes in initializers.

Often, the only attribute in stateful_attributes is previous_value and the only attribute in initializers is initializer, in which case the reset method sets previous_value and value to either the value of the argument (if an argument was passed into reset) or the current value of initializer.

For specific types of StatefulFunction functions, the reset method may carry out other reinitialization steps.

class psyneulink.core.components.functions.statefulfunctions.integratorfunctions.AccumulatorIntegrator(default_variable=None, rate=1.0, increment=0.0, noise=0.0, initializer=None, params=None, owner=None, prefs=None)

Accumulates at a constant rate, that is either linear or exponential, depending on rate. function ignores variable and returns:

$previous\_value \cdot rate + increment + noise$

so that, with each call to function, the accumulated value increases by:

$increment \cdot rate^{time\ step}.$

Thus, accumulation increases lineary in steps of increment if rate=1.0, and exponentially otherwise.

Modulatory Parameters:

MULTIPLICATIVE_PARAM: rate
ADDITIVE_PARAM: increment

Parameters
• default_variable (number, list or array : default class_defaults.variable) – specifies a template for the value to be integrated; if it is a list or array, each element is independently integrated.

• rate (float, list or 1d array : default 1.0) – specifies the rate of decay; if it is a list or array, it must be the same length as variable (see rate for additional details.

• increment (float, list or 1d array : default 0.0) – specifies an amount to be added to previous_value in each call to function; if it is a list or array, it must be the same length as variable (see increment for details).

• noise (float, Function, list or 1d array : default 0.0) – specifies random value added to prevous_value in each call to function; if it is a list or array, it must be the same length as variable (see noise for additonal details).

• initializer (float, list or 1d array : default 0.0) – specifies starting value(s) for integration. If it is a list or array, it must be the same length as default_variable (see initializer for details).

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

• owner (Component) – component to which to assign the Function.

• name (str : default see name) – specifies the name of the Function.

• prefs (PreferenceSet or specification dict : default Function.classPreferences) – specifies the PreferenceSet for the Function (see prefs for details).

variable

Ignored by the AccumulatorIntegrator function. Use LeakyCompetingIntegrator or AdaptiveIntegrator for integrator functions that depend on both a prior value and a new value (variable).

Type

number or array

rate

determines the rate of exponential decay of previous_value in each call to function. If it is a float or has a single element, its value is applied to all the elements of previous_value; if it is an array, each element is applied to the corresponding element of previous_value. Serves as MULTIPLICATIVE_PARAM for modulation of function.

Type

float or 1d array

increment

determines the amount added to previous_value in each call to function. If it is a list or array, it must be the same length as variable and each element is added to the corresponding element of previous_value (i.e., it is used for Hadamard addition). If it is a scalar or has a single element, its value is added to all the elements of previous_value. Serves as ADDITIVE_PARAM for modulation of function.

Type

float, function, or 1d array

noise

random value added in each call to function (see noise for details).

Type

float, Function or 1d array

initializer

determines the starting value(s) for integration (i.e., the value(s) to which previous_value is set (see initializer for details).

Type

float or 1d array

previous_value

stores previous value to which rate and noise will be added.

Type

1d array : default class_defaults.variable

owner

component to which the Function has been assigned.

Type

Component

name

the name of the Function; if it is not specified in the name argument of the constructor, a default is assigned by FunctionRegistry (see Naming for conventions used for default and duplicate names).

Type

str

prefs

the PreferenceSet for function; if it is not specified in the prefs argument of the Function’s constructor, a default is assigned using classPreferences defined in __init__.py (see Preferences for details).

Type

PreferenceSet or specification dict : Function.classPreferences

_accumulator_check_args(variable=None, context=None, params=None, target_set=None)

validate params and assign any runtime params.

Called by AccumulatorIntegrator to validate params Validation can be suppressed by turning parameter_validation attribute off target_set is a params dictionary to which params should be assigned;

Does the following: - assign runtime params to context - validate params if PARAM_VALIDATION is set

Parameters

params – (dict) - params to validate

Target_set

(dict) - set to which params should be assigned

Returns

_function(variable=None, context=None, params=None)
Parameters

params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

Returns

updated value of integral

Return type

2d array

class psyneulink.core.components.functions.statefulfunctions.integratorfunctions.LeakyCompetingIntegrator(default_variable=None, leak=1.0, noise=0.0, offset=None, time_step_size=0.1, initializer=0.0, params=None, owner=None, prefs=None)

Implements Leaky Competitive Accumulator (LCA) described in Usher & McClelland (2001). function returns:

$previous\_value + (variable - leak \cdot previous\_value) \cdot time\_step\_size + noise \sqrt{time\_step\_size}$

where variable corresponds to $$\rho_i$$ + $$\beta$$$$\Sigma f(x_{\neq i})$$ (the net input to a unit), leak corresponds to $$k$$, and time_step_size corresponds to $$\frac{dt}{\tau}$$ in Equation 4 of Usher & McClelland (2001).

Note

When used as the function of an LCAMechanism, the value passed to variable is the sum of the external and recurrent inputs to the Mechanism (see here for how the external and recurrent inputs can be configured in a RecurrentTransferMechanism, of which LCAMechanism is subclass).

Note

the value of the leak argument is assigned to the rate parameter (and the leak parameter as an alias of the rate parameter); this is to be consistent with the parent class, IntegratorFunction. However, note that in contrast to a standard IntegratorFunction, where $$rate \cdot previous\_value$$ is added to variable, here it is subtracted from variable in order to implement decay. Thus, the value returned by the function can increase in a given time step only if rate (aka leak) is negative or variable is sufficiently positive.

Modulatory Parameters:

MULTIPLICATIVE_PARAM: rate
ADDITIVE_PARAM: offset

Parameters
• default_variable (number, list or array : default class_defaults.variable) – specifies a template for the value to be integrated; if it is a list or array, each element is independently integrated.

• leak (float, list or 1d array : default 1.0) – specifies the value used to scale the rate of decay of the integral on each time step. If it is a list or array, it must be the same length as variable (see leak for details).

• noise (float, function, list or 1d array : default 0.0) – specifies random value added to integral in each call to function; if it is a list or array, it must be the same length as variable (see noise for additonal details).

• offset (float, list or 1d array : default 0.0) – specifies a constant value added to integral in each call to function; if it is a list or array, it must be the same length as variable (see offset for details).

• time_step_size (float : default 0.0) – specifies the timing precision of the integration process (see time_step_size for details.

• initializer (float, list or 1d array : default 0.0) – specifies starting value(s) for integration. If it is a list or array, it must be the same length as default_variable (see initializer for details).

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

• owner (Component) – component to which to assign the Function.

• name (str : default see name) – specifies the name of the Function.

• prefs (PreferenceSet or specification dict : default Function.classPreferences) – specifies the PreferenceSet for the Function (see prefs for details).

variable

current input value some portion of which (determined by rate) will be added to the prior value; if it is an array, each element is independently integrated.

Type

number or array

rate

scales the contribution of previous_value to the decay of the value on each time step (corresponding to the leak term of the function described in Equation 4 of Usher & McClelland, 2001). If it is a float or has a single element, its value is applied to all the elements of previous_value; if it is an array, each element is applied to the corresponding element of previous_value. Serves as MULTIPLICATIVE_PARAM for modulation of function.

Note

aliased by the leak parameter.

Type

float, list or 1d array

leak

alias of rate (to be consistent with the standard format of an IntegratorFunction).

Type

float, list or 1d array

noise

random value added to integral in each call to function. (see noise for details).

Type

float, Function, or 1d array

offset

constant value added to integral in each call to function. If variable is an array and offset is a float, offset is applied to each element of the integral; if offset is a list or array, each of its elements is applied to each of the corresponding elements of the integral (i.e., Hadamard addition). Serves as ADDITIVE_PARAM for modulation of function.

Type

float or 1d array

time_step_size

determines the timing precision of the integration process and is used to scale the noise parameter appropriately.

Type

float

initializer

determines the starting value(s) for integration (i.e., the value(s) to which previous_value is set (see initializer for details).

Type

float or 1d array

previous_value

stores previous value with which variable is integrated.

Type

1d array : default class_defaults.variable

owner

component to which the Function has been assigned.

Type

Component

name

the name of the Function; if it is not specified in the name argument of the constructor, a default is assigned by FunctionRegistry (see Naming for conventions used for default and duplicate names).

Type

str

prefs

the PreferenceSet for function; if it is not specified in the prefs argument of the Function’s constructor, a default is assigned using classPreferences defined in __init__.py (see Preferences for details).

Type

PreferenceSet or specification dict : Function.classPreferences

_function(variable=None, context=None, params=None)
Parameters
• variable (number, list or array : default class_defaults.variable) – a single value or array of values to be integrated.

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

Returns

updated value of integral

Return type

2d array

class psyneulink.core.components.functions.statefulfunctions.integratorfunctions.DualAdaptiveIntegrator(default_variable=None, initializer=None, initial_short_term_avg=0.0, initial_long_term_avg=0.0, short_term_gain=1.0, long_term_gain=1.0, short_term_bias=0.0, long_term_bias=0.0, short_term_rate=1.0, long_term_rate=1.0, operation=PRODUCT, offset=0.0, params=None, owner=None, prefs=None)

Combines two exponentially weighted moving averages (EWMA) of its input, each with a different rate, as implemented in Aston-Jones & Cohen (2005) to integrate utility over two time scales.

function computes the EWMA of variable using two integration rates (short_term_rate and long_term_rate <DualAdaptiveIntegrator.long_term_rate>), transforms each using a logistic function, and then combines them, as follows:

• short time scale integral:

$short\_term\_avg = short\_term\_rate \cdot variable + (1 - short\_term\_rate) \cdot previous\_short\_term\_avg$
• long time scale integral:

$long\_term\_avg = long\_term\_rate \cdot variable + (1 - long\_term\_rate) \cdot previous\_long\_term\_avg$
• combined integral:

$value = operation(1-\frac{1}{1+e^{short\_term\_gain\ \cdot\ short\_term\_avg\ +\ short\_term\_bias}},\ \frac{1}{1+e^{long\_term\_gain\ \cdot\ long\_term\_avg + long\_term\_bias}})\ +\ offset$

where operation is the arithmetic operation used to combine the terms.

Modulatory Parameters:

ADDITIVE_PARAM: offset

Parameters
• initial_short_term_avg (float : default 0.0) – specifies starting value for integration of short_term_avg

• initial_long_term_avg (float : default 0.0) – specifies starting value for integration of long_term_avg

• short_term_gain (float : default 1.0) – specifies gain for logistic function applied to short_term_avg

• long_term_gain (float : default 1.0) – specifies gain for logistic function applied to long_term_avg

• short_term_bias (float : default 0.0) – specifies bias for logistic function applied to short_term_avg

• long_term_bias (float : default 0.0) – specifies bias for logistic function applied to long_term_avg

• short_term_rate (float : default 1.0) – specifies smoothing factor of EWMA filter applied to short_term_avg

• long_term_rate (float : default 1.0) – specifies smoothing factor of EWMA filter applied to long_term_avg

• operation (PRODUCT, SUM, S_MINUS_L or L_MINUS_S : default PRODUCT) – specifies the arithmetic operation used to combine the logistics of the short_term_avg and long_term_avg (see operation for details).

• offset (float or 1d array) – constant value added to integral in each call to function after logistics of short_term_avg and long_term_avg are combined; if it is a list or array, it must be the same length as variable (see offset for details.

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

• owner (Component) – component to which to assign the Function.

• name (str : default see name) – specifies the name of the Function.

• prefs (PreferenceSet or specification dict : default Function.classPreferences) – specifies the PreferenceSet for the Function (see prefs for details).

variable

current input value used to compute both the short term and long term EWMA averages.

Type

number or array

initial_short_term_avg

determines starting value for integration of short_term_avg

Type

float

initial_long_term_avg

determines starting value for integration of long_term_avg

Type

float

short_term_gain

determines gain for logistic function applied to short_term_avg

Type

float

long_term_gain

determines gain for logistic function applied to long_term_avg

Type

float

short_term_bias

determines bias for logistic function applied to short_term_avg

Type

float

long_term_bias

determines bias for logistic function applied to long_term_avg

Type

float

short_term_rate

determines smoothing factor of EWMA filter applied to short_term_avg

Type

float

long_term_rate

determines smoothing factor of EWMA filter applied to long_term_avg

Type

float

operation

determines the arithmetic operation used to combine short_term_logistic and long_term_logistic:

• PRODUCT = (1 - short_term_logistic) * long_term_logistic

• SUM = (1 - short_term_logistic) + long_term_logistic

• S_MINUS_L = (1 - short_term_logistic) - long_term_logistic

• L_MINUS_S = long_term_logistic - (1 - short_term_logistic)

Type

str

offset

constant value added to integral in each call to function after logistics of short_term_avg and long_term_avg are combined. If variable is an array and offset is a float, offset is applied to each element of the integral; if offset is a list or array, each of its elements is applied to each of the corresponding elements of the integral (i.e., Hadamard addition). Serves as ADDITIVE_PARAM for modulation of function.

Type

float or 1d array

previous_short_term_avg

stores previous value with which variable is integrated using the EWMA filter and short term parameters

Type

1d array

previous_long_term_avg

stores previous value with which variable is integrated using the EWMA filter and long term parameters

Type

1d array

owner

component to which the Function has been assigned.

Type

Component

name

the name of the Function; if it is not specified in the name argument of the constructor, a default is assigned by FunctionRegistry (see Naming for conventions used for default and duplicate names).

Type

str

prefs

the PreferenceSet for function; if it is not specified in the prefs argument of the Function’s constructor, a default is assigned using classPreferences defined in __init__.py (see Preferences for details).

Type

PreferenceSet or specification dict : Function.classPreferences

_validate_params(request_set, target_set=None, context=None)

Check inner dimension (length) of all parameters used for the function

Insure that for any parameters that are in the Paramaters class, designated as function_arg, and

specified by the user with length>1: 1) they all have the same length; 2) if default_variable:

• was specified by the user, the parameters all have the same length as that

• was NOT specified by the user, they all have the same length as each other; note: in this case, default_variable will be set to the length of those parameters in

_instantiate_attributes_before_function below

_function(variable=None, context=None, params=None)
Parameters
• variable (number, list or array : default class_defaults.variable) – a single value or array of values to be integrated.

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

Returns

updated value of integral

Return type

2d array

reset(short=None, long=None, context=NotImplemented)

Effectively begins accumulation over again at the specified utilities.

Sets previous_short_term_avg to the quantity specified in the first argument and previous_long_term_avg to the quantity specified in the second argument.

Sets value by computing it based on the newly updated values for previous_short_term_avg and previous_long_term_avg.

If no arguments are specified, then the current values of initial_short_term_avg and initial_long_term_avg are used.

class psyneulink.core.components.functions.statefulfunctions.integratorfunctions.InteractiveActivationIntegrator(default_variable=None, rate=1.0, decay=1.0, rest=0.0, max_val=1.0, min_val=- 1.0, noise=0.0, initializer=None, params=None, owner=None, prefs=None)

Implements a generalized version of the interactive activation from McClelland and Rumelhart (1981) that integrates current value of variable toward an asymptotic maximum value max_val for positive inputs and toward an asymptotic mininum value (min_val) for negative inputs, and decays asymptotically towards an intermediate resting value (rest).

function returns:

$previous\_value + (rate * (variable + noise) * distance\_from\_asymptote) - (decay * distance\_from\_rest)$

where:

$if\ variable > 0,\ distance\_from\_asymptote = max\_val - previous\_value$
$if\ variable < 0,\ distance\_from\_asymptote = previous\_value - min\_val$
$if\ variable = 0,\ distance\_from\_asymptote = 0$
Parameters
• default_variable (number, list or array : default class_defaults.variable) – specifies a template for the value to be integrated; if it is a list or array, each element is independently integrated.

• rate (float, list or 1d array : default 1.0) – specifies the rate of change in activity; its value(s) must be in the interval [0,1]. If it is a list or array, it must be the same length as variable.

• decay (float, list or 1d array : default 1.0) – specifies the rate of at which activity decays toward rest. If it is a list or array, it must be the same length as variable; its value(s) must be in the interval [0,1].

• rest (float, list or 1d array : default 0.0) – specifies the initial value and one toward which value decays. If it is a list or array, it must be the same length as variable.

• max_val (float, list or 1d array : default 1.0) – specifies the maximum asymptotic value toward which integration occurs for positive values of variable. If it is a list or array, it must be the same length as variable; all values must be greater than the corresponding values of min_val (see max_val for details).

• min_val (float, list or 1d array : default 1.0) – specifies the minimum asymptotic value toward which integration occurs for negative values of variable. If it is a list or array, it must be the same length as variable; all values must be greater than the corresponding values of max_val (see max_val for details).

• noise (float, function, list or 1d array : default 0.0) – specifies random value added to variable in each call to function; if it is a list or array, it must be the same length as variable (see noise for details).

• initializer (float, list or 1d array : default 0.0) – specifies starting value(s) for integration. If it is a list or array, it must be the same length as default_variable (see initializer for details).

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

• owner (Component) – component to which to assign the Function.

• name (str : default see name) – specifies the name of the Function.

• prefs (PreferenceSet or specification dict : default Function.classPreferences) – specifies the PreferenceSet for the Function (see prefs for details).

variable

current input value some portion of which (determined by rate) will be added to the prior value; if it is an array, each element is independently integrated.

Type

number or array

rate

determines the rate at which activity increments toward either max_val (variable is positive) or min_val (if variable is negative). If it is a float or has a single element, it is applied to all elements of variable; if it has more than one element, each element is applied to the corresponding element of variable. Serves as MULTIPLICATIVE_PARAM for modulation of function.

Type

float or 1d array in interval [0,1]

decay

determines the rate of at which activity decays toward rest (similary to rate in other IntegratorFuncgtions). If it is a float or has a single element, it applies to all elements of variable; if it has more than one element, each element applies to the corresponding element of variable.

Type

float or 1d array

rest

determines the initial value and one toward which value decays (similar to bias in other IntegratorFunctions). If it is a float or has a single element, it applies to all elements of variable; if it has more than one element, each element applies to the corresponding element of variable.

Type

float or 1d array

max_val

determines the maximum asymptotic value toward which integration occurs for positive values of variable. If it is a float or has a single element, it applies to all elements of variable; if it has more than one element, each element applies to the corresponding element of variable.

Type

float or 1d array

min_val

determines the minimum asymptotic value toward which integration occurs for negative values of variable. If it is a float or has a single element, it applies to all elements of variable; if it has more than one element, each element applies to the corresponding element of variable.

Type

float or 1d array

noise

random value added to variable in each call to function (see noise for details).

Type

float, Function or 1d array

initializer

determines the starting value(s) for integration (i.e., the value(s) to which previous_value is set (see initializer for details).

Type

float or 1d array

previous_value

stores previous value with which variable is integrated.

Type

1d array : default class_defaults.variable

owner

component to which the Function has been assigned.

Type

Component

name

the name of the Function; if it is not specified in the name argument of the constructor, a default is assigned by FunctionRegistry (see Naming for conventions used for default and duplicate names).

Type

str

prefs

the PreferenceSet for function; if it is not specified in the prefs argument of the Function’s constructor, a default is assigned using classPreferences defined in __init__.py (see Preferences for details).

Type

PreferenceSet or specification dict : Function.classPreferences

_validate_params(request_set, target_set=None, context=None)

Check inner dimension (length) of all parameters used for the function

Insure that for any parameters that are in the Paramaters class, designated as function_arg, and

specified by the user with length>1: 1) they all have the same length; 2) if default_variable:

• was specified by the user, the parameters all have the same length as that

• was NOT specified by the user, they all have the same length as each other; note: in this case, default_variable will be set to the length of those parameters in

_instantiate_attributes_before_function below

_function(variable=None, context=None, params=None)
Parameters
• variable (number, list or array : default class_defaults.variable) – a single value or array of values to be integrated.

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

Returns

updated value of integral

Return type

2d array

class psyneulink.core.components.functions.statefulfunctions.integratorfunctions.IntegratorFunction(default_variable=None, initializer=None, rate=1.0, noise=0.0, time_step_size=1.0, params=None, owner=None, prefs=None)

Base class for Functions that integrate current value of variable with its prior value. For most subclasses, variable can be a single float or an array. If it is an array, each element is integrated independently of the others.

Note

If variable is an array, for any parameter that is specified as a float its value is applied uniformly to all elements of the relevant term of the integral (e.g., variable or previous_value, depending on the subclass); for any parameter specified as an array, it must be the same length as variable, and it is applied elementwise (Hadarmard) to the relevant term of the integral. If, on initialization, the default_variable is not specified, any parameters specified as an array must be the same length, and the default_variable is assumed to have the same length as those parameters.

Parameters
• default_variable (number, list or array : default class_defaults.variable) – specifies a template for the value to be integrated; if it is a list or array, each element is independently integrated.

• initializer (float, list or 1d array : default 0.0) – specifies starting value(s) for integration. If it is a list or array, it must be the same length as variable (see initializer for details).

• rate (float, list or 1d array : default 1.0) – specifies the rate of integration. If it is a list or array, it must be the same length as variable (see rate for details).

• noise (float, function, list or 1d array : default 0.0) – specifies random value added to integral in each call to function; if it is a list or array, it must be the same length as variable (see noise for additonal details).

• time_step_size (float : default 0.0) – determines the timing precision of the integration process

• params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the function. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.

• owner (Component) – component to which to assign the Function.

• name (str : default see name) – specifies the name of the Function.

• prefs (PreferenceSet or specification dict : default Function.classPreferences) – specifies the PreferenceSet for the Function (see prefs for details).

variable

current input value some portion of which (determined by rate) that will be added to the prior value; if it is an array, each element is independently integrated.

Type

number or array

.. _Integrator_Rate
rate

determines the rate of integration. If it is a float or has a single value, it is applied to all elements of variable and/or previous_value (depending on the subclass); if it has more than one element, each element is applied to the corresponding element of variable and/or previous_value.

Type

float or 1d array

.. _Integrator_Noise
noise

random value added to integral in each call to function. If variable is a list or array, and noise is a float or function, it is applied for each element of variable. If noise is a function, it is executed and applied separately for each element of variable. If noise is a list or array, each element is applied to each element of the integral corresponding that of variable.

Hint

To generate random noise that varies for every execution, a probability distribution function should be used (see Distribution Functions for details), that generates a new noise value from its distribution on each execution. If noise is specified as a float, a function with a fixed output, or a list or array of either of these, then noise is simply an offset that remains the same across all executions.

Type

float, Function or 1d array

.. _Integrator_Initializer
initializer

determines the starting value(s) for integration (i.e., the value(s) to which previous_value is set. If variable is a list or array, and initializer is a float or has a single element, it is applied to each element of previous_value. If initializer is a list or array, each element is applied to the corresponding element of previous_value.

Type

float or 1d array

previous_value

stores previous value with which variable is integrated.

Type

1d array

owner

component to which the Function has been assigned.

Type

Component

name

the name of the Function; if it is not specified in the name argument of the constructor, a default is assigned by FunctionRegistry (see Naming for conventions used for default and duplicate names).

Type

str

prefs

the PreferenceSet for function; if it is not specified in the prefs argument of the Function’s constructor, a default is assigned using classPreferences defined in __init__.py (see Preferences for details).

Type

PreferenceSet or specification dict : Function.classPreferences

_validate_params(request_set, target_set=None, context=None)

Check inner dimension (length) of all parameters used for the function

Insure that for any parameters that are in the Paramaters class, designated as function_arg, and

specified by the user with length>1: 1) they all have the same length; 2) if default_variable:

• was specified by the user, the parameters all have the same length as that

• was NOT specified by the user, they all have the same length as each other; note: in this case, default_variable will be set to the length of those parameters in

_instantiate_attributes_before_function below

_instantiate_attributes_before_function(function=None, context=None)

Insure inner dimension of default_variable matches the length of any parameters that have len>1

_EWMA_filter(previous_value, rate, variable)

Return exponentially weighted moving average (EWMA) of a variable.

_logistic(variable, gain, bias)

Return logistic transform of variable