IntegratorFunctions

Functions that integrate current value of input with previous value.

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

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

rate

float or 1d array – 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.

increment

float, function, or 1d array – 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.

noise

float, Function or 1d array – random value added in each call to function (see noise for details).

initializer

float or 1d array – determines the starting value(s) for integration (i.e., the value(s) to which previous_value is set (see initializer for details).

previous_value

1d array : default class_defaults.variable – stores previous value to which rate and noise will be added.

owner

Componentcomponent to which the Function has been assigned.

name

str – 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).

prefs

PreferenceSet or specification dict : Function.classPreferences – 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 PreferenceSet for details).

function(variable=None, execution_id=None, params=None, context=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.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

number or array – 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.

rate

float or 1d array – 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.

noise

float, Function or 1d array – random value added to integral in each call to function (see noise for details).

offset

float or 1d array – 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.

initializer

float or 1d array – determines the starting value(s) for integration (i.e., the value to which previous_value is set (see initializer for details).

previous_value

1d array : default class_defaults.variable – stores previous value with which variable is integrated.

owner

Componentcomponent to which the Function has been assigned.

name

str – 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).

prefs

PreferenceSet or specification dict : Function.classPreferences – 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 PreferenceSet for details).

function(variable=None, execution_id=None, params=None, context=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

number or array – 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.

rate

float or 1d array – 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.

noise

float, Function or 1d array – random value added to integral in each call to function (see noise for details).

offset

float or 1d array – 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.

initializer

float or 1d array – determines the starting value(s) for integration (i.e., the value(s) to which previous_value is set (see initializer for details).

previous_value

1d array : default class_defaults.variable – stores previous value with which variable is integrated.

owner

Componentcomponent to which the Function has been assigned.

name

str – 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).

prefs

PreferenceSet or specification dict : Function.classPreferences – 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 PreferenceSet for details).

function(variable=None, execution_id=None, params=None, context=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

number or array – current input value used to compute both the short term and long term EWMA averages.

initial_short_term_avg

float – determines starting value for integration of short_term_avg

initial_long_term_avg

float – determines starting value for integration of long_term_avg

short_term_gain

float – determines gain for logistic function applied to short_term_avg

long_term_gain

float – determines gain for logistic function applied to long_term_avg

short_term_bias

float – determines bias for logistic function applied to short_term_avg

long_term_bias

float – determines bias for logistic function applied to long_term_avg

short_term_rate

float – determines smoothing factor of EWMA filter applied to short_term_avg

long_term_rate

float – determines smoothing factor of EWMA filter applied to long_term_avg

operation

str – 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)
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 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.

previous_short_term_avg

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

previous_long_term_avg

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

owner

Componentcomponent to which the Function has been assigned.

name

str – 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).

prefs

PreferenceSet or specification dict : Function.classPreferences – 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 PreferenceSet for details).

function(variable=None, execution_id=None, params=None, context=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

reinitialize(short=None, long=None, execution_context=None)

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

number or array – 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.

rate

float or 1d array in interval [0,1] – 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.

decay

float or 1d array – 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.

rest

float or 1d array – 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.

max_val

float or 1d array – 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.

min_val

float or 1d array – 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.

noise

float, Function or 1d array – random value added to variable in each call to function (see noise for details).

initializer

float or 1d array – determines the starting value(s) for integration (i.e., the value(s) to which previous_value is set (see initializer for details).

previous_value

1d array : default class_defaults.variable – stores previous value with which variable is integrated.

owner

Componentcomponent to which the Function has been assigned.

name

str – 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).

prefs

PreferenceSet or specification dict : Function.classPreferences – 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 PreferenceSet for details).

function(variable=None, execution_id=None, params=None, context=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.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) – determspecifies ines 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

float or array – 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.

rate

float or 1d array – 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.

noise

float – 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.

offset

float or 1d array – constant value added to integral in each call to function if it’s absolute value is below threshold. 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.

starting_point

float or 1d array – determines the start the starting value for the integration process; if it is a list or array, it must be the same length as variable. If variable is an array and starting_point is a float, starting_point is used for each element of the integral; if starting_point is a list or array, each of its elements is used as the starting point for each element of the integral.

threshold

float – determines the boundaries of the drift diffusion process: the integration process can be scheduled to terminate when the result of function equals or exceeds either the positive or negative value of threshold (see hint).

Hint

For a Mechanism to terminate execution when the DriftDiffusionIntegrator reaches its threshold, the function, the Mechanisms to which it assigned must belong to a System or Composition with a Scheduler that applies the WhenFinished Condition to that Mechanism.

time_step_size

float – determines the timing precision of the integration process and is used to scale the noise parameter according to the standard DDM probability distribution.

initializer

float or 1d array – determines the starting value(s) for integration (i.e., the value(s) to which previous_value is set (see initializer for details).

previous_time

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

previous_value

1d array : default class_defaults.variable – stores previous value with which variable is integrated.

owner

Componentcomponent to which the Function has been assigned.

name

str – 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).

prefs

PreferenceSet or specification dict : Function.classPreferences – 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 PreferenceSet for details).

function(variable=None, execution_id=None, params=None, context=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

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

number or array – 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.

rate

float or 1d array – 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.

decay

float or 1d array – 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.

noise

float – 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.

offset

float or 1d array – 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.

starting_point

float – determines the start time of the integration process.

time_step_size

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

initializer

float or 1d array – determines the starting value(s) for integration (i.e., the value(s) to which previous_value is set (see initializer for details).

previous_value

1d array : default class_defaults.variable – stores previous value with which variable is integrated.

previous_time

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

owner

Componentcomponent to which the Function has been assigned.

name

str – 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).

prefs

PreferenceSet or specification dict : Function.classPreferences – 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 PreferenceSet for details).

function(variable=None, execution_id=None, params=None, context=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.LeakyCompetingIntegrator(default_variable=None, rate=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:

\[rate \cdot previous\_value + variable + noise \sqrt{time\_step\_size}\]

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 value used to scale the contribution of previous_value to the integral on each time step. 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).
  • 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) – 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

number or array – 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.

rate

float or 1d array – scales the contribution of previous_value to the accumulation of the value on each time step. 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.

noise

float, Function, or 1d array – random value added to integral in each call to function. (see noise for details).

offset

float or 1d array – 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.

time_step_size

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

initializer

float or 1d array – determines the starting value(s) for integration (i.e., the value(s) to which previous_value is set (see initializer for details).

previous_value

1d array : default class_defaults.variable – stores previous value with which variable is integrated.

owner

Componentcomponent to which the Function has been assigned.

name

str – 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).

prefs

PreferenceSet or specification dict : Function.classPreferences – 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 PreferenceSet for details).

function(variable=None, execution_id=None, params=None, context=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.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

number or array – External stimulus

previous_v

1d array : default class_defaults.variable – stores accumulated value of v during integration

previous_w

1d array : default class_defaults.variable – stores accumulated value of w during integration

previous_t

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

owner

Componentcomponent to which the Function has been assigned.

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 – 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.
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

prefs

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

function(variable=None, execution_id=None, params=None, context=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