Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/log/nparray executions #2844

Merged
merged 62 commits into from
Nov 15, 2023
Merged

Feat/log/nparray executions #2844

merged 62 commits into from
Nov 15, 2023

Conversation

jdcpni
Copy link
Collaborator

@jdcpni jdcpni commented Nov 15, 2023

  • log.py
    nparray(), nparray_dictionary(), _assemble_entry_data():
    add report_all_executions option that reports all executions for a given TIME_STEP

jdcpni added 30 commits October 11, 2023 08:06
  - _add_error_projection_to_dependent_learning_mechs,
    _create_non_terminal_backprop_learning_components:
    separate error_sources for parallel InputPort/OutputPort "streams" in a single Mechanism that use TransferFunctions
• autodiffcomposition.py, pytorchcomponents.py:
  standardize on value of PytorchMechanismWrapper as 2d
  to accomodate >1 output_ports
• composition.py
  _create_backpropagation_learning_pathway():
    determine dependent_learning_mechanisms locally
• learningmechanism.py
    remove dependent_learning_mechanisms property
• composition.py
  refactor learning pathways to be specific to input_port and output_ports (to accomodate parallel pathways through Mechanisms with TransferFunction:
   - add _get_ports_for_input_output_sources()
   - _create_terminal_backprop_learning_components()
     _create_learning_related_mechanisms()
     _create_learning_related_projections():
     all take input_source_output_port and output_source_input_port as args
• composition.py
  - _add_error_projection_to_dependent_learning_mechs():
    if mechanism uses TransferFunction, only consider dependent_learning_projections
    for projections to input_port with same index as output_port of error_source
• composition.py
  refactor learning pathways to be specific to input_port and output_ports (to accomodate parallel pathways through Mechanisms with TransferFunction:
   - add _get_ports_for_input_output_sources()
   - _create_terminal_backprop_learning_components()
     _create_learning_related_mechanisms()
     _create_learning_related_projections():
     all take input_source_output_port and output_source_input_port as args
• processingmechanism.py:
  - _instantiate_output_ports():
     if no OutputPorts are specified, and variable has more than one item, assign one OutputPort to each
• Passes all pytests
• Tests for multiple output_ports with learning need to be added
• test_learning.py
  - TestAutodiffMultipleOutput_port:
    - add test_parallel_inputs_to_output_ports_converge_internal
    - add test_single_input_to_multiple_output_ports_converge_internal
• test_learning.py
  - TestAutodiffMultipleOutput_ports
    - add test_single_input_to_multiple_output_ports_converge_on_OUTPUT_Node
• composition.py
  - _create_backpropagation_learning_pathway():
    - raise error for terminal node with > 1 output_ports
• composition.py
  - _create_backpropagation_learning_pathway():
    - raise error for terminal node with > 1 output_ports
• composition.py
  _instantiate_input_dict():
  refactor to format user-specified inputs
• composition.py
  - _create_backpropagation_learning_pathway():
    - raise error for terminal node with > 1 output_ports
• composition.py
  _instantiate_input_dict():
  refactor to format user-specified inputs
…_ports' into refactor/learning_pathways_using_ports
jdcpni added 25 commits November 3, 2023 08:59
PASSES ALL TESTS
PASSES ALL TESTS
• test_composition.py
  add test_input_shape_errors
• processingmechanism.py
  docstring description of configuration
• test_processing_mechanism.py
  - test_processing_mechanism_multiple_input_ports: add tests for specifying names and/or variables for output_ports
  add test_two_output_ports_on_OUTPUT_Node
  add test_two_output_ports_on_OUTPUT_Node
  - rename nodes

• autodiffcomposition.py
  infer_backpropagation_learning_pathways():
  - only exclude ModulatoryProjections or ones that don't have a 'learnable' attribute
# Conflicts:
#	psyneulink/library/compositions/emcomposition.py
• emcomposition.py
  execute(): autodiff execution commented out
• emcomposition.py
  execute(): use autodiff
…Link into devel

# Conflicts:
#	psyneulink/library/compositions/emcomposition.py
  nparray(), nparray_dictionary(), _assemble_entry_data():
   add report_all_executions option that reports all executions for a given TIME_STEP
  nparray(), nparray_dictionary(), _assemble_entry_data():
   add report_all_executions option that reports all executions for a given TIME_STEP
Copy link

This PR causes the following changes to the html docs (ubuntu-latest-3.11-x64):

diff -r docs-base/AutoAssociativeProjection.html docs-head/AutoAssociativeProjection.html
246,247c246,247
< <p>Due to its specialized nature, most parameters of the AutoAssociativeProjection are not configurable: the <a class="reference internal" href="LeabraMechanism.html#psyneulink.library.components.mechanisms.processing.leabramechanism.LeabraFunction.variable" title="psyneulink.library.components.mechanisms.processing.leabramechanism.LeabraFunction.variable"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">variable</span></code></a> is
< determined by the format of the output of the RecurrentTransferMechanism, the <a class="reference internal" href="LCControlMechanism.html#psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.function" title="psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> is always LinearMatrix, and so
---
> <p>Due to its specialized nature, most parameters of the AutoAssociativeProjection are not configurable: the <a class="reference internal" href="ControlProjection.html#psyneulink.core.components.projections.modulatory.controlprojection.ControlProjection.variable" title="psyneulink.core.components.projections.modulatory.controlprojection.ControlProjection.variable"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">variable</span></code></a> is
> determined by the format of the output of the RecurrentTransferMechanism, the <a class="reference internal" href="ControlSignal.html#psyneulink.core.components.ports.modulatorysignals.controlsignal.ControlSignal.function" title="psyneulink.core.components.ports.modulatorysignals.controlsignal.ControlSignal.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> is always LinearMatrix, and so
diff -r docs-base/AutodiffComposition.html docs-head/AutodiffComposition.html
391,392c391,392
< <li><p>the <a class="reference internal" href="KohonenMechanism.html#psyneulink.library.components.mechanisms.processing.transfer.kohonenmechanism.KohonenMechanism.matrix" title="psyneulink.library.components.mechanisms.processing.transfer.kohonenmechanism.KohonenMechanism.matrix"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">matrix</span></code></a> parameter of Projections</p></li>
< <li><p>the <a class="reference internal" href="LCControlMechanism.html#psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.value" title="psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.value"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">value</span></code></a> parameter of its inner components</p></li>
---
> <li><p>the <a class="reference internal" href="AutoAssociativeProjection.html#psyneulink.library.components.projections.pathway.autoassociativeprojection.AutoAssociativeProjection.matrix" title="psyneulink.library.components.projections.pathway.autoassociativeprojection.AutoAssociativeProjection.matrix"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">matrix</span></code></a> parameter of Projections</p></li>
> <li><p>the <a class="reference internal" href="ControlProjection.html#psyneulink.core.components.projections.modulatory.controlprojection.ControlProjection.value" title="psyneulink.core.components.projections.modulatory.controlprojection.ControlProjection.value"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">value</span></code></a> parameter of its inner components</p></li>
diff -r docs-base/BasicsAndPrimer.html docs-head/BasicsAndPrimer.html
269c269
< <a class="reference internal" href="index_logo_with_text.html#tutorial"><span class="std std-ref">tutorial</span></a> provides additional introductory material for those who are newer to computational modeling,
---
> <a class="reference internal" href="index.html#tutorial"><span class="std std-ref">tutorial</span></a> provides additional introductory material for those who are newer to computational modeling,
1128c1128
< <a class="reference internal" href="index_logo_with_text.html#tutorial"><span class="std std-ref">Tutorial</span></a> provides a more thorough, interactive introduction to its use, and the <a class="reference internal" href="UserGuide.html"><span class="doc">User's Guide</span></a> provides
---
> <a class="reference internal" href="index.html#tutorial"><span class="std std-ref">Tutorial</span></a> provides a more thorough, interactive introduction to its use, and the <a class="reference internal" href="UserGuide.html"><span class="doc">User's Guide</span></a> provides
diff -r docs-base/BeukersNBackModel.html docs-head/BeukersNBackModel.html
211c211
< <p>(Instructions for running the actual notebook can be found <a class="reference internal" href="index_logo_with_text.html#tutorial"><span class="std std-ref">here</span></a>, replacing <code class="docutils literal notranslate"><span class="pre">nback_nb</span></code> for <code class="docutils literal notranslate"><span class="pre">tutorial</span></code>)</p>
---
> <p>(Instructions for running the actual notebook can be found <a class="reference internal" href="index.html#tutorial"><span class="std std-ref">here</span></a>, replacing <code class="docutils literal notranslate"><span class="pre">nback_nb</span></code> for <code class="docutils literal notranslate"><span class="pre">tutorial</span></code>)</p>
diff -r docs-base/BotvinickConflictMonitoringModel.html docs-head/BotvinickConflictMonitoringModel.html
273c273
< The <a class="reference internal" href="Log.html#module-psyneulink.core.globals.log" title="psyneulink.core.globals.log"><code class="xref any py py-mod docutils literal notranslate"><span class="pre">log</span></code></a> function is used to record the output values of <em>RESPONSE LAYER</em>. These values are used to produce
---
> The <a class="reference internal" href="Component.html#psyneulink.core.components.component.Component.log" title="psyneulink.core.components.component.Component.log"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">log</span></code></a> function is used to record the output values of <em>RESPONSE LAYER</em>. These values are used to produce
diff -r docs-base/Cohen_HustonModel.html docs-head/Cohen_HustonModel.html
292c292
< <p>The <a class="reference internal" href="Log.html#module-psyneulink.core.globals.log" title="psyneulink.core.globals.log"><code class="xref any py py-mod docutils literal notranslate"><span class="pre">log</span></code></a> function is used to record the output values of the <em>RESPONSE LAYER</em>. The cyles until a threshold is reached
---
> <p>The <a class="reference internal" href="Component.html#psyneulink.core.components.component.Component.log" title="psyneulink.core.components.component.Component.log"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">log</span></code></a> function is used to record the output values of the <em>RESPONSE LAYER</em>. The cyles until a threshold is reached
diff -r docs-base/CombinationFunctions.html docs-head/CombinationFunctions.html
588c588
< <p><code class="xref any docutils literal notranslate"><span class="pre">function</span></code> returns a 2d array with the items of <a class="reference internal" href="LeabraMechanism.html#psyneulink.library.components.mechanisms.processing.leabramechanism.LeabraFunction.variable" title="psyneulink.library.components.mechanisms.processing.leabramechanism.LeabraFunction.variable"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">variable</span></code></a> rearranged
---
> <p><code class="xref any docutils literal notranslate"><span class="pre">function</span></code> returns a 2d array with the items of <a class="reference internal" href="ControlProjection.html#psyneulink.core.components.projections.modulatory.controlprojection.ControlProjection.variable" title="psyneulink.core.components.projections.modulatory.controlprojection.ControlProjection.variable"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">variable</span></code></a> rearranged
diff -r docs-base/Component.html docs-head/Component.html
362c362
< <a class="reference internal" href="LCControlMechanism.html#psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.function" title="psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> attribute of the Component.</p>
---
> <a class="reference internal" href="ControlSignal.html#psyneulink.core.components.ports.modulatorysignals.controlsignal.ControlSignal.function" title="psyneulink.core.components.ports.modulatorysignals.controlsignal.ControlSignal.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> attribute of the Component.</p>
390c390
< <p>In general, Components that have an execute() method may use this to assign the <a class="reference internal" href="LCControlMechanism.html#psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.value" title="psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.value"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">value</span></code></a> of the Component
---
> <p>In general, Components that have an execute() method may use this to assign the <a class="reference internal" href="ControlProjection.html#psyneulink.core.components.projections.modulatory.controlprojection.ControlProjection.value" title="psyneulink.core.components.projections.modulatory.controlprojection.ControlProjection.value"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">value</span></code></a> of the Component
428c428
< <a class="reference internal" href="KohonenMechanism.html#psyneulink.library.components.mechanisms.processing.transfer.kohonenmechanism.KohonenMechanism.output_ports" title="psyneulink.library.components.mechanisms.processing.transfer.kohonenmechanism.KohonenMechanism.output_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">output_ports</span></code></a>, and <a class="reference internal" href="Mechanism.html#psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.function" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a>, are all listed in parameters, and are user-modifiable,
---
> <a class="reference internal" href="DDM.html#psyneulink.library.components.mechanisms.processing.integrator.ddm.DDM.output_ports" title="psyneulink.library.components.mechanisms.processing.integrator.ddm.DDM.output_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">output_ports</span></code></a>, and <a class="reference internal" href="Mechanism.html#psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.function" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a>, are all listed in parameters, and are user-modifiable,
755c755
< <dd class="field-odd"><p><a class="reference internal" href="CompositionInterfaceMechanism.html#psyneulink.core.components.mechanisms.processing.compositioninterfacemechanism.CompositionInterfaceMechanism.Parameters" title="psyneulink.core.components.mechanisms.processing.compositioninterfacemechanism.CompositionInterfaceMechanism.Parameters">Parameters</a></p>
---
> <dd class="field-odd"><p><a class="reference internal" href="AutodiffComposition.html#psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.Parameters" title="psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.Parameters">Parameters</a></p>
diff -r docs-base/Composition.html docs-head/Composition.html
974c974
< the <a class="reference internal" href="#psyneulink.core.compositions.composition.NodeRole" title="psyneulink.core.compositions.composition.NodeRole"><code class="xref any py py-class docutils literal notranslate"><span class="pre">NodeRoles</span></code></a> <a class="reference internal" href="#psyneulink.core.compositions.composition.NodeRole.TARGET" title="psyneulink.core.compositions.composition.NodeRole.TARGET"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">TARGET</span></code></a> and <a class="reference internal" href="Log.html#psyneulink.core.globals.log.LogCondition.LEARNING" title="psyneulink.core.globals.log.LogCondition.LEARNING"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">LEARNING</span></code></a> in the Composition.</p></li>
---
> the <a class="reference internal" href="#psyneulink.core.compositions.composition.NodeRole" title="psyneulink.core.compositions.composition.NodeRole"><code class="xref any py py-class docutils literal notranslate"><span class="pre">NodeRoles</span></code></a> <a class="reference internal" href="#psyneulink.core.compositions.composition.NodeRole.TARGET" title="psyneulink.core.compositions.composition.NodeRole.TARGET"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">TARGET</span></code></a> and <a class="reference internal" href="#psyneulink.core.compositions.composition.NodeRole.LEARNING" title="psyneulink.core.compositions.composition.NodeRole.LEARNING"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">LEARNING</span></code></a> in the Composition.</p></li>
987c987
< – see below); this is assigned the <a class="reference internal" href="#psyneulink.core.compositions.composition.NodeRole" title="psyneulink.core.compositions.composition.NodeRole"><code class="xref any py py-class docutils literal notranslate"><span class="pre">NodeRole</span></code></a> <a class="reference internal" href="Log.html#psyneulink.core.globals.log.LogCondition.LEARNING" title="psyneulink.core.globals.log.LogCondition.LEARNING"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">LEARNING</span></code></a> in the Composition.</p></li>
---
> – see below); this is assigned the <a class="reference internal" href="#psyneulink.core.compositions.composition.NodeRole" title="psyneulink.core.compositions.composition.NodeRole"><code class="xref any py py-class docutils literal notranslate"><span class="pre">NodeRole</span></code></a> <a class="reference internal" href="#psyneulink.core.compositions.composition.NodeRole.LEARNING" title="psyneulink.core.compositions.composition.NodeRole.LEARNING"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">LEARNING</span></code></a> in the Composition.</p></li>
995c995
< <a class="reference internal" href="LearningMechanism.html#learningmechanism-learning-configurations"><span class="std std-ref">Learning Configurations</span></a> for details); these are assigned the <a class="reference internal" href="#psyneulink.core.compositions.composition.NodeRole" title="psyneulink.core.compositions.composition.NodeRole"><code class="xref any py py-class docutils literal notranslate"><span class="pre">NodeRole</span></code></a> <a class="reference internal" href="Log.html#psyneulink.core.globals.log.LogCondition.LEARNING" title="psyneulink.core.globals.log.LogCondition.LEARNING"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">LEARNING</span></code></a> in
---
> <a class="reference internal" href="LearningMechanism.html#learningmechanism-learning-configurations"><span class="std std-ref">Learning Configurations</span></a> for details); these are assigned the <a class="reference internal" hre
...

See CI logs for the full diff.

@coveralls
Copy link

Coverage Status

coverage: 84.651% (-0.03%) from 84.681%
when pulling 5944980 on feat/log/nparray_executions
into b61f894 on devel.

@jdcpni jdcpni merged commit a947643 into devel Nov 15, 2023
63 checks passed
@jdcpni jdcpni deleted the feat/log/nparray_executions branch November 15, 2023 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants