Abstract base class for Functions the result of which depend on their
default_variable (number, list or array : default class_defaults.variable) – specifies a template for
rate (float, list or 1d array : default 1.0) – specifies value used as a scaling parameter in a subclass-dependent way (see
ratefor details); if it is a list or array, it must be the same length as
noise (float, function, list or 1d array : default 0.0) – specifies random value added in each call to
function; if it is a list or array, it must be the same length as
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.
name (str : default see
name) – specifies the name of the Function.
prefs (PreferenceSet or specification dict : default Function.classPreferences) – specifies the
PreferenceSetfor the Function (see
current input value.
number or array
determines initial value assigned to
variableis 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
float or 1d array
last value returned (i.e., for which state is being maintained).
stores the names of the initialization attributes for each of the stateful attributes of the function. The index i item in initializers provides the initialization value for the index i item in
stores the names of each of the stateful attributes of the function. The index i item in stateful_attributes is initialized by the value of the initialization attribute whose name is stored in index i of
initializers. In most cases, the stateful_attributes, in that order, are the return values of the function.
- .. _Stateful_Rate
on each call to
function, applied to
previous_value, neither, or both, depending on implementation by subclass. If it is a float or has a single value, it is applied to all elements of its target(s); if it has more than one element, each element is applied to the corresponding element of its target(s).
float or 1d array
- .. _Stateful_Noise
random value added on each call to
variableis 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, it is applied elementwise (i.e., in Hadamard form).
To generate random noise that varies for every execution, a probability distribution function should be used (see
Distribution Functionsfor 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.
A ParameterPort for noise will only be generated, and the noise Parameter itself will only be stateful, if the value of noise is entirely numeric (contains no functions) at the time of Mechanism construction.
float, function, list, or 1d array
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).
PreferenceSetfor the Function; if it is not specified in the prefs argument of the Function’s constructor, a default is assigned using
classPreferencesdefined in __init__.py (see Preferences for details).
PreferenceSet or specification dict
Eventually should contain all validation methods, occurs at end of Component.__init__
Validate params and assign validated values to targets,
This performs top-level type validation of params
This can be overridden by a subclass to perform more detailed checking (e.g., range, recursive, etc.) It is called only if the parameter_validation attribute is
True(which it is by default)
- IMPLEMENTATION NOTES:
future versions should add recursive and content (e.g., range) checking
should method return validated param set?
validated (dict (target_set) - repository of params that have been) –
- Return none
the values of the keyword arguments in the order in which they appear in this Component’s
- Return type
If arguments are passed into the reset method, then reset sets each of the attributes in
stateful_attributesto the value of the corresponding argument. Next, it sets the
valueto a list containing each of the argument values.
If reset is called without arguments, then it sets each of the attributes in
stateful_attributesto the value of the corresponding attribute in
initializers. Next, it sets the
valueto a list containing the values of each of the attributes in
Often, the only attribute in
previous_valueand the only attribute in
initializer, in which case the reset method sets
valueto either the value of the argument (if an argument was passed into reset) or the current value of
For specific types of StatefulFunction functions, the reset method may carry out other reinitialization steps.