diff --git a/.idea/runConfigurations/Make_HTML.xml b/.idea/runConfigurations/Make_HTML.xml
index eacc86ebae0..52e2eb9e7aa 100644
--- a/.idea/runConfigurations/Make_HTML.xml
+++ b/.idea/runConfigurations/Make_HTML.xml
@@ -1,14 +1,13 @@
+
-
-
diff --git a/Scripts/Examples/EVC-Gratton.py b/Scripts/Examples/EVC-Gratton.py
index 73b963eab4b..56ec63d6760 100644
--- a/Scripts/Examples/EVC-Gratton.py
+++ b/Scripts/Examples/EVC-Gratton.py
@@ -145,8 +145,8 @@
# Show graph of system (with control components)
# mySystem.show_graph(show_dimensions=pnl.ALL, show_projection_labels=True)
-# mySystem.show_graph(show_control=True, show_projection_labels=False)
-mySystem.show_graph(show_control=True, show_mechanism_structure=True, show_headers=False)
+mySystem.show_graph(show_control=True, show_projection_labels=False)
+# mySystem.show_graph(show_control=True, show_mechanism_structure=True, show_headers=False)
# configure EVC components
mySystem.controller.control_signals[0].intensity_cost_function = pnl.Exponential(rate=0.8046).function
diff --git a/Scripts/Examples/Multilayer-Learning FOR FIG.py b/Scripts/Examples/Multilayer-Learning FOR FIG.py
new file mode 100644
index 00000000000..203423d8911
--- /dev/null
+++ b/Scripts/Examples/Multilayer-Learning FOR FIG.py
@@ -0,0 +1,134 @@
+import functools
+import numpy as np
+import psyneulink as pnl
+
+Input_Layer = pnl.TransferMechanism(
+ name='Input',
+ function=pnl.Logistic,
+ params={pnl.INPUT_LABELS_DICT:{'red': [-1, 30]}},
+ default_variable=np.zeros((2,)))
+
+Hidden_Layer_1 = pnl.TransferMechanism(
+ name='Hidden1',
+ function=pnl.Logistic(),
+ default_variable=np.zeros((5,)))
+
+Hidden_Layer_2 = pnl.TransferMechanism(
+ name='Hidden2',
+ function=pnl.Logistic(),
+ default_variable=[0, 0, 0, 0])
+
+Output_Layer = pnl.TransferMechanism(
+ name='Output',
+ function=pnl.Logistic,
+ default_variable=[0, 0, 0])
+
+Input_Weights_matrix = (np.arange(2 * 5).reshape((2, 5)) + 1) / (2 * 5)
+Middle_Weights_matrix = (np.arange(5 * 4).reshape((5, 4)) + 1) / (5 * 4)
+Output_Weights_matrix = (np.arange(4 * 3).reshape((4, 3)) + 1) / (4 * 3)
+
+# This Projection will be used by the Process below by referencing it in the Process' pathway;
+# note: sender and receiver args don't need to be specified
+Input_Weights = pnl.MappingProjection(
+ name='Input Weights',
+ matrix=Input_Weights_matrix
+)
+
+# This Projection will be used by the Process below by assigning its sender and receiver args
+# to mechanisms in the pathway
+Middle_Weights = pnl.MappingProjection(
+ name='Middle Weights',
+ sender=Hidden_Layer_1,
+ receiver=Hidden_Layer_2,
+ matrix=Middle_Weights_matrix
+)
+
+# Treated same as Middle_Weights Projection
+Output_Weights = pnl.MappingProjection(
+ name='Output Weights',
+ sender=Hidden_Layer_2,
+ receiver=Output_Layer,
+ matrix=Output_Weights_matrix
+)
+
+z = pnl.Process(
+ default_variable=[0, 0],
+ pathway=[
+ Input_Layer,
+ # The following reference to Input_Weights is needed to use it in the pathway
+ # since it's sender and receiver args are not specified in its declaration above
+ Input_Weights,
+ Hidden_Layer_1,
+ # Middle_Weights,
+ # No Projection specification is needed here since the sender arg for Middle_Weights
+ # is Hidden_Layer_1 and its receiver arg is Hidden_Layer_2
+ Hidden_Layer_2,
+ # Output_Weights,
+ # Output_Weights does not need to be listed for the same reason as Middle_Weights
+ # If Middle_Weights and/or Output_Weights is not declared above, then the Process
+ # will assign a default for rhe missing Projection
+ Output_Layer
+ ],
+ clamp_input=pnl.SOFT_CLAMP,
+ learning=pnl.LEARNING,
+ target=[0, 0, 1],
+ prefs={
+ pnl.VERBOSE_PREF: False,
+ pnl.REPORT_OUTPUT_PREF: True
+ }
+)
+
+
+def print_header(system):
+ print("\n\n**** Time: ", system.scheduler_processing.clock.simple_time)
+
+
+def show_target(system):
+ i = system.input
+ t = system.target_input_states[0].value
+ print('\nOLD WEIGHTS: \n')
+ print('- Input Weights: \n', Input_Weights.matrix)
+ print('- Middle Weights: \n', Middle_Weights.matrix)
+ print('- Output Weights: \n', Output_Weights.matrix)
+
+ print('\nSTIMULI:\n\n- Input: {}\n- Target: {}\n'.format(i, t))
+ print('ACTIVITY FROM OLD WEIGHTS: \n')
+ print('- Middle 1: \n', Hidden_Layer_1.value)
+ print('- Middle 2: \n', Hidden_Layer_2.value)
+ print('- Output:\n', Output_Layer.value)
+
+
+mySystem = pnl.System(
+ processes=[z],
+ targets=[0, 0, 1],
+ learning_rate=2.0
+)
+
+# Log Middle_Weights of MappingProjection to Hidden_Layer_2
+# Hidden_Layer_2.set_log_conditions('Middle Weights')
+Middle_Weights.set_log_conditions('matrix')
+
+mySystem.reportOutputPref = True
+# Shows graph will full information:
+# mySystem.show_graph(show_dimensions=pnl.ALL)
+mySystem.show_graph()
+# mySystem.show_graph(show_learning=pnl.ALL, show_dimensions=pnl.ALL, show_mechanism_structure=True)
+# Shows minimal graph:
+# mySystem.show_graph()
+
+
+stim_list = {Input_Layer: ['red']}
+target_list = {Output_Layer: [[0, 0, 1]]}
+
+mySystem.run(
+ num_trials=10,
+ inputs=stim_list,
+ targets=target_list,
+ call_before_trial=functools.partial(print_header, mySystem),
+ call_after_trial=functools.partial(show_target, mySystem),
+ termination_processing={pnl.TimeScale.TRIAL: pnl.AfterNCalls(Output_Layer, 1)}
+)
+
+# Print out logged weights for Middle_Weights
+# print('\nMiddle Weights (to Hidden_Layer_2): \n', Hidden_Layer_2.log.nparray(entries='Middle Weights', header=False))
+print('\nMiddle Weights (to Hidden_Layer_2): \n', Middle_Weights.log.nparray(entries='matrix', header=False))
diff --git a/Scripts/Examples/Multilayer-Learning.py b/Scripts/Examples/Multilayer-Learning.py
index 6e9438c664c..e1ded7b450f 100644
--- a/Scripts/Examples/Multilayer-Learning.py
+++ b/Scripts/Examples/Multilayer-Learning.py
@@ -111,7 +111,7 @@ def show_target(system):
mySystem.reportOutputPref = True
# Shows graph will full information:
# mySystem.show_graph(show_dimensions=pnl.ALL)
-mySystem.show_graph(show_learning=pnl.ALL, show_dimensions=pnl.ALL)
+mySystem.show_graph(show_learning=True)
# mySystem.show_graph(show_learning=pnl.ALL, show_dimensions=pnl.ALL, show_mechanism_structure=True)
# Shows minimal graph:
# mySystem.show_graph()
diff --git a/Scripts/Laura Stroop w EVC.py b/Scripts/Laura Stroop w EVC.py
new file mode 100644
index 00000000000..45fe6cf354d
--- /dev/null
+++ b/Scripts/Laura Stroop w EVC.py
@@ -0,0 +1,18 @@
+import numpy as np
+import matplotlib.pyplot as plt
+import psyneulink as pnl
+
+ci = pnl.TransferMechanism(size=2, name='COLORS INPUT')
+wi = pnl.TransferMechanism(size=2, name='WORDS INPUT')
+ch = pnl.TransferMechanism(size=2, function=pnl.Logistic, name='COLORS HIDDEN')
+wh = pnl.TransferMechanism(size=2, function=pnl.Logistic, name='WORDS HIDDEN')
+tl = pnl.TransferMechanism(size=2, function=pnl.Logistic(gain=pnl.CONTROL), name='TASK CONTROL')
+rl = pnl.LCA(size=2, function=pnl.Logistic, name='RESPONSE')
+cp = pnl.Process(pathway=[ci, ch, rl])
+wp = pnl.Process(pathway=[wi, wh, rl])
+tc = pnl.Process(pathway=[tl, ch])
+tw = pnl.Process(pathway=[tl,wh])
+s = pnl.System(processes=[tc, tw, cp, wp],
+ controller=pnl.EVCControlMechanism(name='EVC Mechanimsm'),
+ monitor_for_control=[rl])
+s.show_graph()
diff --git a/Scripts/Laura Stroop.py b/Scripts/Laura Stroop.py
index 26fafac6e66..e99b5da5c5a 100644
--- a/Scripts/Laura Stroop.py
+++ b/Scripts/Laura Stroop.py
@@ -312,7 +312,8 @@ def pass_threshold(mech1, mech2, thresh):
respond_green_accumulator.reinitialize(0)
respond_red_accumulator.reinitialize(0)
# now run test trial
-my_Stroop.show_graph(show_mechanism_structure=pnl.VALUES)
+my_Stroop.show_graph()
+# my_Stroop.show_graph(show_mechanism_structure=pnl.VALUES)
my_Stroop.run(inputs=CN_incongruent_trial_input, termination_processing=terminate_trial)
diff --git a/Scripts/Markus EVC Control Script.py b/Scripts/Markus EVC Control Script.py
new file mode 100644
index 00000000000..1fcdd7caf43
--- /dev/null
+++ b/Scripts/Markus EVC Control Script.py
@@ -0,0 +1,244 @@
+import numpy as np
+import psyneulink as pnl
+
+# Control Parameters
+signalSearchRange = np.arange(1.0,3.1,0.5) # why 0.8 to 2.0 in increments of 0.2 np.array([1.0])#
+
+
+test_mech = pnl.TransferMechanism(size=1)
+
+# Stimulus Mechanisms
+Target_Stim = pnl.TransferMechanism(name='Target Stimulus', function=pnl.Linear(slope=0.3324))
+Target_Stim.set_log_conditions('value')
+Flanker_Stim = pnl.TransferMechanism(name='Flanker Stimulus', function=pnl.Linear(slope=0.3545))
+Flanker_Stim.set_log_conditions('value')
+
+# Processing Mechanisms (Control)
+Target_Rep = pnl.TransferMechanism(name='Target Representation',
+ function=pnl.Linear(
+ slope=(1.0, pnl.ControlProjection(
+ control_signal_params={
+ pnl.ALLOCATION_SAMPLES: signalSearchRange}))),
+ prefs = {pnl.LOG_PREF: pnl.PreferenceEntry(pnl.LogCondition.INITIALIZATION, pnl.PreferenceLevel.INSTANCE)})
+Target_Rep.set_log_conditions('value') # Log Target_Rep
+Target_Rep.set_log_conditions('slope') # Log Target_Rep
+Target_Rep.loggable_items
+
+#log initialization
+
+Target_Rep.log.LogCondition =2
+
+Flanker_Rep = pnl.TransferMechanism(name='Flanker Representation',
+ function=pnl.Linear(
+ slope=(1.0, pnl.ControlProjection(
+ control_signal_params={
+ pnl.ALLOCATION_SAMPLES: signalSearchRange}))))
+Flanker_Rep.set_log_conditions('value') # Log Flanker_Rep
+Flanker_Rep.set_log_conditions('slope') # Log Flanker_Rep
+Flanker_Rep.loggable_items
+
+Target_Rep.log.LogCondition =2
+
+# Processing Mechanism (Automatic)
+Automatic_Component = pnl.TransferMechanism(name='Automatic Component',function=pnl.Linear)
+Automatic_Component.loggable_items
+Automatic_Component.set_log_conditions('value')
+
+# Decision Mechanisms
+Decision = pnl.DDM(function=pnl.BogaczEtAl(
+ drift_rate=1.0,
+ threshold=0.2645,
+ # noise=(0.5),
+ starting_point=0,
+ t0=0.15
+ ),name='Decision',
+ output_states=[
+ pnl.DECISION_VARIABLE,
+ pnl.RESPONSE_TIME,
+ pnl.PROBABILITY_UPPER_THRESHOLD,
+ {
+ pnl.NAME: 'OFFSET_RT',
+ pnl.VARIABLE: (pnl.OWNER_VALUE, 1),
+ pnl.FUNCTION: pnl.Linear(0, slope=0.0, intercept=1).function
+ }
+ ],) #drift_rate=(1.0),threshold=(0.2645),noise=(0.5),starting_point=(0), t0=0.15
+Decision.set_log_conditions('DECISION_VARIABLE')
+Decision.set_log_conditions('value')
+Decision.set_log_conditions('PROBABILITY_UPPER_THRESHOLD')
+Decision.set_log_conditions('InputState-0')
+Decision.set_log_conditions('drift_rate')
+
+Decision.set_log_conditions('OFFSET_RT')
+
+Decision.set_log_conditions('RESPONSE_TIME')
+
+Decision.loggable_items
+
+# Outcome Mechanisms:
+Reward = pnl.TransferMechanism(name='Reward')
+Reward.set_log_conditions('value')
+# Processes:
+TargetControlProcess = pnl.Process(
+ default_variable=[0],
+ pathway=[Target_Stim, Target_Rep, Decision],
+ name='Target Control Process'
+)
+
+FlankerControlProcess = pnl.Process(
+ default_variable=[0],
+ pathway=[Flanker_Stim, Flanker_Rep, Decision],
+ name='Flanker Control Process'
+)
+
+TargetAutomaticProcess = pnl.Process(
+ default_variable=[0],
+ pathway=[Target_Stim, Automatic_Component, Decision],
+ name='Target Automatic Process'
+)
+
+FlankerAutomaticProcess = pnl.Process(
+ default_variable=[0],
+ pathway=[Flanker_Stim, Automatic_Component, Decision],
+ name='Flanker1 Automatic Process'
+)
+
+RewardProcess = pnl.Process(
+ default_variable=[0],
+ pathway=[Reward, test_mech],
+ name='RewardProcess'
+)
+
+
+# System:
+mySystem = pnl.System(processes=[TargetControlProcess,
+ FlankerControlProcess,
+ TargetAutomaticProcess,
+ FlankerAutomaticProcess,
+ RewardProcess],
+ controller=pnl.EVCControlMechanism(prefs={pnl.LOG_PREF: pnl.PreferenceEntry(pnl.LogCondition.INITIALIZATION, pnl.PreferenceLevel.INSTANCE)}),
+ enable_controller=True,
+ monitor_for_control=[
+ # (None, None, np.ones((1,1))),
+ Reward,
+ Decision.PROBABILITY_UPPER_THRESHOLD,
+ ('OFFSET_RT', 1, -1),
+ ],
+ name='EVC Markus System')
+
+# Show characteristics of system:
+mySystem.show()
+# mySystem.controller.show()
+
+# Show graph of system
+# mySystem.show_graph(show_control=pnl.ALL, show_dimensions=pnl.ALL)# show_control=True,show_dimensions=True)
+mySystem.show_graph(show_control=pnl.ALL, show_mechanism_structure=True)# show_control=True,show_dimensions=True)
+
+
+#log input state of mySystem
+mySystem.controller.loggable_items
+mySystem.controller.set_log_conditions('InputState-0')
+mySystem.controller.set_log_conditions('value')
+
+mySystem.controller.set_log_conditions('Flanker Representation[slope] ControlSignal')
+mySystem.controller.set_log_conditions('Target Representation[slope] ControlSignal')
+
+mySystem.controller.objective_mechanism.set_log_conditions('value')
+mySystem.controller.objective_mechanism.set_log_conditions('PROBABILITY_UPPER_THRESHOLD')
+mySystem.controller.objective_mechanism.set_log_conditions('OFFSET_RT')
+
+# print('current input value',mySystem.controller.input_states.values)
+# print('current objective mech output value',mySystem.controller.objective_mechanism.output_states.values)
+#
+
+
+# configure EVC components
+mySystem.controller.control_signals[0].intensity_cost_function = pnl.Exponential(rate=0.8046).function
+mySystem.controller.control_signals[1].intensity_cost_function = pnl.Exponential(rate=0.8046).function
+#
+# #change prediction mechanism function_object.rate for all 3 prediction mechanisms
+#
+mySystem.controller.prediction_mechanisms.mechanisms[0].function_object.rate = 1.0
+mySystem.controller.prediction_mechanisms.mechanisms[1].function_object.rate = 0.0 # reward rate
+mySystem.controller.prediction_mechanisms.mechanisms[2].function_object.rate = 1.0
+
+
+
+
+
+# log predictions:
+#how to log this??? with prefs??
+#mySystem.controller.prediction_mechanisms.mechanisms.
+
+
+# add weight matrix for input updates here ! ??? ask Sebastian on march 9!
+
+# W_new = W_hat_old + alpha*(W_hat_predicted - W_actual)
+
+
+
+
+# for mech in mySystem.controller.prediction_mechanisms.mechanisms:
+# if mech.name == 'Flanker Stimulus Prediction Mechanism' or mech.name == 'Target Stimulus Prediction Mechanism':
+# # when you find a key mechanism (transfer mechanism) with the correct name, print its name
+# # print(mech.name)
+# mech.function_object.rate = 1.0
+#
+# if 'Reward' in mech.name:
+# # print(mech.name)
+# mech.function_object.rate = 1.0
+# # mySystem.controller.prediction_mechanisms[mech].parameterStates['rate'].base_value = 1.0
+#
+
+
+
+#Markus: incongruent trial weights:
+
+# f = np.array([1,1])
+# W_inc = np.array([[1.0, 0.0],[0.0, 1.5]])
+# W_con = np.array([[1.0, 0.0],[1.5, 0.0]])
+
+
+# generate stimulus environment: remember that we add one congruent stimulus infront of actuall stimulus list
+# compatible with MATLAB stimulus list for initialization
+nTrials = 7
+targetFeatures = [1.0, 1.0, 1.0, 1.0,1.0, 1.0, 1.0, 1.0]
+flankerFeatures = [1.0, 1.0, 1.0, 1.0,-1.0, -1.0, 1.0, -1.0]
+reward = [100, 100, 100, 100, 100, 100, 100, 100]
+
+stim_list_dict = {
+ Target_Stim: targetFeatures,
+ Flanker_Stim: flankerFeatures,
+ Reward: reward
+
+}
+Target_Rep.set_log_conditions('slope')
+# mySystem.controller.objective_mechanism.loggable_items
+mySystem.run(num_trials=nTrials,inputs=stim_list_dict)
+
+# Flanker_Rep.log.print_entries()
+# Target_Rep.log.print_entries()
+# Decision.log.print_entries()
+
+# print('output state of objective mechanism', mySystem.controller.objective_mechanism.output_states.values)
+#
+# print('input state of EVC Control mechanism', mySystem.controller.input_state.value)
+#
+# print('mapping projection from objective mechanism to EVC Control mechanism',mySystem.controller.projections[0].matrix)
+
+# mySystem.controller.log.print_entries()
+
+# Reward.log.print_entries()
+D = Decision.log.nparray_dictionary()
+print(D['drift_rate'])
+
+Flanker_Rep.log.print_entries()
+
+mySystem.controller.log.print_entries()
+
+
+d = mySystem.controller.objective_mechanism.log.nparray_dictionary()
+mySystem.controller.objective_mechanism.log.print_entries()
+print(d['PROBABILITY_UPPER_THRESHOLD'])
+
+
+# assert np.allclose([94.81, 47.66, 94.81, 94.81, 47.66, 47.66, 94.81, 47.66],
\ No newline at end of file
diff --git a/psyneulink/components/component.py b/psyneulink/components/component.py
index 5e522e869f5..6f4067d96b9 100644
--- a/psyneulink/components/component.py
+++ b/psyneulink/components/component.py
@@ -2814,9 +2814,8 @@ def initialize(self):
def execute(self, variable=None, runtime_params=None, context=None):
return self._execute(variable=variable, runtime_params=runtime_params, context=context)
- def _execute(self, variable=None, runtime_params=None, context=None):
+ def _execute(self, variable=None, runtime_params=None, context=None, **kwargs):
- # MODIFIED 3/20/18 NEW:
from psyneulink.components.functions.function import Function
if isinstance(self, Function):
pass # Functions don't have a Logs or maintain execution_counts or time
@@ -2824,8 +2823,11 @@ def _execute(self, variable=None, runtime_params=None, context=None):
if self.context.initialization_status & ~(ContextFlags.VALIDATING | ContextFlags.INITIALIZING):
self._increment_execution_count()
self._update_current_execution_time(context=context) # cxt-pass
- # MODIFIED 3/20/18 END
- return self.function(variable=variable, params=runtime_params, context=context)
+
+ # IMPLEMENTION NOTE: **kwargs is included to accommodate required arguments
+ # that are specific to particular class of Functions
+ # (e.g., error_matrix for LearningMechanism and controller for EVCControlMechanism)
+ return self.function(variable=variable, params=runtime_params, context=context, **kwargs)
@property
def execution_count(self):
diff --git a/psyneulink/components/mechanisms/adaptive/learning/learningmechanism.py b/psyneulink/components/mechanisms/adaptive/learning/learningmechanism.py
index a44f0f77691..e6b72ed27ec 100644
--- a/psyneulink/components/mechanisms/adaptive/learning/learningmechanism.py
+++ b/psyneulink/components/mechanisms/adaptive/learning/learningmechanism.py
@@ -1178,10 +1178,10 @@ def _execute(self,
for error_signal_input, error_matrix in zip(error_signal_inputs, error_matrices):
function_variable[ERROR_OUTPUT_INDEX] = error_signal_input
- learning_signal, error_signal = self.function(variable=function_variable,
- error_matrix=error_matrix,
- params=runtime_params,
- context=context)
+ learning_signal, error_signal = super()._execute(variable=function_variable,
+ error_matrix=error_matrix,
+ runtime_params=runtime_params,
+ context=context)
# Sum learning_signals and error_signals
try:
summed_learning_signal += learning_signal
diff --git a/psyneulink/components/mechanisms/mechanism.py b/psyneulink/components/mechanisms/mechanism.py
index 0000d1caf9f..e773a1f3e51 100644
--- a/psyneulink/components/mechanisms/mechanism.py
+++ b/psyneulink/components/mechanisms/mechanism.py
@@ -664,7 +664,7 @@ class `UserList `; if specified, the dictionary is contained in
the Mechanism's `target_labels_dict ` attribute.
COMMENT
-
+ ..
* *OUTPUT_LABELS_DICT* -- used to specify labels for values of the OutputState(s) of the Mechanism; if specified,
the dictionary is contained in the Mechanism's `output_labels_dict ` attribute.
@@ -692,13 +692,14 @@ class `UserList ` has *label_value* entries, and the Mechanism has more than one InputState,
+ then a specified label will be associated with the corresponding `value ` for any of the
+ Mechanism's InputStates.
COMMENT:
ADD EXAMPLE HERE
COMMENT
@@ -706,7 +707,7 @@ class `UserList :* -- this is used to specify labels that are specific to individual States
of the type corresponding to the dictionary; the key of each entry must be either the name of a State of that
type, or its index in the list of States of that type (i.e, `input_states ` or
- `output_states `, and the value a subdictionary containing *label:value* entries
+ `output_states `), and the value a subdictionary containing *label:value* entries
to be used for that State. For example, if a Mechanism has two InputStates, named *SAMPLE* and *TARGET*, then
*INPUT_LABELS_DICT* could be assigned two entries, *SAMPLE*: and *TARGET*: or, correspondingly,
0: and 1:, in which each dict contained separate *label:value* entries for each of the two
@@ -2033,7 +2034,7 @@ def reinitialize(self, *args):
new_input = self.integrator_function.reinitialize(*args)
if hasattr(self, "initial_value"):
self.initial_value = np.atleast_2d(*args)
- self.value = self.function(new_input, context="REINITIALIZING")
+ self.value = super()._execute(variable=new_input, context="REINITIALIZING")
self._update_output_states(context="REINITIALIZING")
elif self.integrator_function is None:
@@ -2150,9 +2151,9 @@ def execute(self,
# Only call subclass' _execute method and then return (do not complete the rest of this method)
elif self.initMethod is INIT__EXECUTE__METHOD_ONLY:
return_value = self._execute(
- variable=self.instance_defaults.variable,
- runtime_params=runtime_params,
- context=context,
+ variable=self.instance_defaults.variable,
+ runtime_params=runtime_params,
+ context=context,
)
# IMPLEMENTATION NOTE: THIS IS HERE BECAUSE IF return_value IS A LIST, AND THE LENGTH OF ALL OF ITS
@@ -2178,9 +2179,9 @@ def execute(self,
# Call only subclass' function during initialization (not its full _execute method nor rest of this method)
elif self.initMethod is INIT_FUNCTION_METHOD_ONLY:
- return_value = self.function(
+ return_value = super()._execute(
variable=self.instance_defaults.variable,
- params=runtime_params,
+ runtime_params=runtime_params,
context=context,
)
return np.atleast_2d(return_value)
diff --git a/psyneulink/components/mechanisms/processing/transfermechanism.py b/psyneulink/components/mechanisms/processing/transfermechanism.py
index 0632d3f1960..01b91025bee 100644
--- a/psyneulink/components/mechanisms/processing/transfermechanism.py
+++ b/psyneulink/components/mechanisms/processing/transfermechanism.py
@@ -990,7 +990,7 @@ def _execute(self,
if isinstance(self.function_object, TransferFunction):
- outputs = self.function(variable=current_input, params= runtime_params)
+ outputs = super()._execute(variable=current_input, runtime_params=runtime_params, context=context)
if clip is not None:
minCapIndices = np.where(outputs < clip[0])
maxCapIndices = np.where(outputs > clip[1])
@@ -1000,7 +1000,7 @@ def _execute(self,
# Apply TransferMechanism's function to each input state separately
outputs = []
for elem in current_input:
- output_item = self.function(variable=elem, params=runtime_params)
+ output_item = super()._execute(variable=elem, runtime_params=runtime_params, context=context)
if clip is not None:
minCapIndices = np.where(output_item < clip[0])
maxCapIndices = np.where(output_item > clip[1])
diff --git a/psyneulink/globals/log.py b/psyneulink/globals/log.py
index c6e5d771e91..a376823eebe 100644
--- a/psyneulink/globals/log.py
+++ b/psyneulink/globals/log.py
@@ -406,9 +406,10 @@
class LogCondition(IntEnum):
"""Used to specify the context in which a value of the Component or its attribute is `logged `.
+
.. note::
- This is meant to be a subset of (and therefore references) ContextFlags bitwise enum, with the exception of
- TRIAL and RUN, which are bit-shifted to follow the ContextFlags.SIMULATION value.
+ The values of LogCondition are subset of (and directly reference) the ContextFlags bitwise enum,
+ with the exception of TRIAL and RUN, which are bit-shifted to follow the ContextFlags.SIMULATION value.
"""
OFF = ContextFlags.UNSET
# """No recording."""
diff --git a/psyneulink/library/mechanisms/adaptive/learning/autoassociativelearningmechanism.py b/psyneulink/library/mechanisms/adaptive/learning/autoassociativelearningmechanism.py
index fee4d33faf3..121aa6b2f24 100644
--- a/psyneulink/library/mechanisms/adaptive/learning/autoassociativelearningmechanism.py
+++ b/psyneulink/library/mechanisms/adaptive/learning/autoassociativelearningmechanism.py
@@ -353,9 +353,12 @@ def _execute(self,
"""
# COMPUTE LEARNING SIGNAL (note that function is assumed to return only one value)
- self.learning_signal = self.function(variable=variable,
- params=runtime_params,
- context=context)
+ # IMPLEMENTATION NOTE: skip LearningMechanism's implementation of _execute
+ # as it assumes projections from other LearningMechanisms
+ # which are not relevant to an autoassociative projection
+ self.learning_signal = super(LearningMechanism, self)._execute(variable=variable,
+ runtime_params=runtime_params,
+ context=context)
if not INITIALIZING in context and self.reportOutputPref: # cxt-test
print("\n{} weight change matrix: \n{}\n".format(self.name, self.learning_signal))
diff --git a/psyneulink/library/mechanisms/processing/objective/predictionerrormechanism.py b/psyneulink/library/mechanisms/processing/objective/predictionerrormechanism.py
index d9a4102ec76..d8203f137af 100644
--- a/psyneulink/library/mechanisms/processing/objective/predictionerrormechanism.py
+++ b/psyneulink/library/mechanisms/processing/objective/predictionerrormechanism.py
@@ -307,7 +307,7 @@ def _execute(self, variable=None, runtime_params=None, context=None):
reward = self.input_states[TARGET].value
variable = [sample, reward]
- delta = self.function(variable=variable)
+ delta = self._execute(variable=variable, runtime_params=runtime_params, context=context)
delta = delta[1:]
delta = np.append(delta, 0)
diff --git a/psyneulink/library/subsystems/agt/lccontrolmechanism.py b/psyneulink/library/subsystems/agt/lccontrolmechanism.py
index 7a77f356e26..8f24d86d643 100644
--- a/psyneulink/library/subsystems/agt/lccontrolmechanism.py
+++ b/psyneulink/library/subsystems/agt/lccontrolmechanism.py
@@ -866,9 +866,10 @@ def _execute(self,
context=None):
"""Updates LCControlMechanism's ControlSignal based on input and mode parameter value
"""
- output_values = self.function(variable=variable,
- params=runtime_params,
- context=context)
+ # IMPLEMENTATION NOTE: skip ControlMechanism._execute since it is a stub method that returns input_values
+ output_values = super(ControlMechanism, self)._execute(variable=variable,
+ runtime_params=runtime_params,
+ context=context)
gain_t = self.scaling_factor_gain*output_values[1] + self.base_level_gain
diff --git a/psyneulink/library/subsystems/evc/evccontrolmechanism.py b/psyneulink/library/subsystems/evc/evccontrolmechanism.py
index 93fea5b99d7..e09f8024659 100644
--- a/psyneulink/library/subsystems/evc/evccontrolmechanism.py
+++ b/psyneulink/library/subsystems/evc/evccontrolmechanism.py
@@ -912,10 +912,12 @@ def _execute(self,
# IMPLEMENTATION NOTE:
# self.system._store_system_state()
- allocation_policy = self.function(controller=self,
- variable=variable,
- runtime_params=runtime_params,
- context=context)
+ # IMPLEMENTATION NOTE: skip ControlMechanism._execute since it is a stub method that returns input_values
+ allocation_policy = super(ControlMechanism, self)._execute(controller=self,
+ variable=variable,
+ runtime_params=runtime_params,
+ context=context)
+
# IMPLEMENTATION NOTE:
# self.system._restore_system_state()