ModulatoryMechanism¶
Subclasses
Contents¶
Overview¶
A ModulatoryMechanism is a type of Mechanism that modifies the operation of one or more other Components. In general, a ModulatoryMechanism receives its input from an ObjectiveMechanism, however this need not be the case.
There are two primary types of ModulatoryMechanism:
- ControlMechanism
modulates the
value
of a Port of a Mechanism. Takes an evaluative signal (generally received from an ObjectiveMechanism) and generates acontrol_allocation
, each item of which is assigned to one of its ControlSignals; each of those generates acontrol_signal
that is used by its ControlProjection(s) to modulate the parameter of afunction
(and thereby thevalue
) of a Port. ControlSignals have costs, and a ControlMechanism has acosts
and anet_outcome
that is computed based on thecosts
of its ControlSignals. A ControlMechanism can be assigned only the ControlSignal class of ModulatorySignal, but can be also be assigned other generic OutputPorts that appear after its ControlSignals in itsoutput_ports
attribute.Gating Mechanism is a specialized subclass of ControlMechanism, that is used to modulate the
value
of an InputPort or OutputPort, and that uses GatingSignals which do not have any cost attributes.
- LearningMechanism
modulates the
matrix
parameter of a MappingProjection. Takes an error signal (received from an ObjectiveMechanism or another LearningMechanism) and generates alearning_signal
that is provided to its LearningSignal(s), and used by their LearningProjections to modulate thematrix
parameter of a MappingProjection. A LearningMechanism can be assigned only the LearningSignal class of ModulatorySignal as its OuputStates, but can be also be assigned other generic OutputPorts, that appear after its LearningSignals in itsoutput_ports
attribute.
A single ModulatoryMechanism can be assigned more than one ModulatorySignal of the appropriate type, each of which
can be assigned different control_allocations
(for ControlSignals) or
learning_signals
(for LearningSignals). A single ModulatorySignal can also be
assigned multiple ModulatoryProjections; however, as described in ModulatoryProjections, they will all
be assigned the same variable
.
Naming Conventions for Modulatory Components¶
Modulatory Components and their attributes are named according to the type of modulation using the following templates:
- ModulatoryMechanism name
<Type>Mechanism (e.g., ControlMechanism)
- ModulatorySignal name
<Type>Signal (e.g., ControlSignal)
- ModulatoryProjection name
<Type>Projection (e.g., ControlProjection)
- List of a ModulatoryMechanism’s ModulatorySignals
<Type>Mechanism.<type>_signals (e.g., ControlMechanism.control_signals)
- Value of a ModulatorySignal
<Type>Signal.<type>_signal (e.g., ControlSignal.control_signal)
Creating a ModulatoryMechanism¶
A ModulatoryMechanism is created by calling the constructor for the desired type. ModulatoryMechanisms of the
appropriate subtype can also be created automatically when other Components are created that require them (for
example, one or more LearningMechanism are created when a learning pathway
is specified for a Composition (see subtypes of
ModulatoryMechanisms for more specific information about how to create them).
Structure¶
A ModulatoryMechanism has the same basic structure as a Mechanism. In addition, every ModulatoryMechanism
has a modulation
attribute, that determines the default method by which its
ModulatorySignals modify the value of the Components that they modulate (see the modulation for a description of how modulation operates, and the documentation for individual
subtypes of ModulatoryMechanism for more specific information about their structure and modulatory operation).
Execution¶
The execution of a ModulatoryMechanism follows the same sequence of actions as a standard Mechanism
(Execution). However, in the context of a Composition, its ModulatoryProjections are often feedback
connections to other Mechanisms in the Composition, forming a cycle in the Composition,
and thus the ModulatoryMechanism may need to be properly initialized (see Cycles and Feedback).
Also, a ControlMechanism can be the controller
of a Composition in which case its
execution is handled separately from other Mechanisms in the Composition (see Controller Execution).
As noted below, the modifications made by a ModulatoryMechanism to a parameter that it modulates are not available to
that parameter’s Component until after the Modulatory executes, which may not be until the next TRIAL
(e.g., the matrix
parameter of a MappingProjection that is subject
to learning in a Composition; or a parameter modulated by a ControlMechanism that is the
controller of a Composition that executes last (see Controller Execution).
Note
A Port that receives a ModulatoryProjection from a ModulatoryMechanism does not update its value until its owner Mechanism executes (see Lazy Evaluation for an explanation of “lazy” updating). This means that even if a ModulatoryMechanism has executed, a parameter that it modulates will not assume its new value until the Mechanism to which it belongs has executed.
Class Reference¶
- class psyneulink.core.components.mechanisms.modulatory.modulatorymechanism.ModulatoryMechanism_Base(default_variable, input_shapes, modulation, params, name, prefs, context=None, function=None, **kwargs)¶
Subclass of Mechanism that modulates the value(s) of one or more other Component(s). See Mechanism and subclasses for arguments and additional attributes.
Note
ModulatoryMechanism is an abstract class and should never be instantiated by a call to its constructor. They should be instantiated using the constructor for a subclass.
- modulation¶
determines how the output of the ModulatoryMechanism’s ModulatorySignal(s) are used to modulate the value of the Port(s) to which their ModulatoryProjection(s) project.
- Type
str
- exception psyneulink.core.components.mechanisms.modulatory.modulatorymechanism.ModulatoryMechanismError(message, component=None)¶