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

Updated Huston Cohen 1994 model #2222

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

JeshuaT
Copy link

@JeshuaT JeshuaT commented Dec 3, 2021

Set back all the parameter values to the original settings as in the 1994 Cohen and Huston paper. Most importantly: now the weights before and after initialization are set correctly. I've also changed it so neutral input can be 1 (weight for neutral input was on 0), and I've changed it so that both word/color --> response and response --> word/color are changed before and after initialization. No idea what the rationale was from the original author how it was done, but for me, it didn't make sense!

Furthermore, settling time to 500, and added variables slope and intercept. Otherwise, I've tried to leave it as much as how the original model was written.

Set back all the parameter values to the original settings as in the 1994 Cohen and Huston paper. Most importantly: now the weights before and after initialization are set correctly. I've also changed it so neutral input can be 1 (weight for neutral input was on 0), and I've changed it so that both word/color --> response and response --> word/color are changed before and after initialization. No idea what the rationale was from the original author how it was done, but for me it didn't make sense!
Comma missing and changed settle time to 500 (does not matter qualitatively, but looks more like the cohen/huston 1994 plot). And made some things prettier.
@JeshuaT JeshuaT changed the title Patch 1 Updated Huston Cohen 1994 model Dec 3, 2021
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Dec 3, 2021

This pull request fixes 4 alerts when merging 0788f44 into 912f691 - view on LGTM.com

fixed alerts:

  • 4 for Variable defined multiple times

@kmantel kmantel changed the base branch from master to devel December 3, 2021 22:20
@github-actions
Copy link

github-actions bot commented Dec 3, 2021

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

diff -r docs-base/.buildinfo docs-head/.buildinfo
3c3
< config: e4eaff8bd460a1755b5775922fbff125
---
> config: 93a36d7daeeffc980fdbe13b5661e43b
diff -r docs-base/AutoAssociativeLearningMechanism.html docs-head/AutoAssociativeLearningMechanism.html
228c228
< <p>An AutoAssociativeLearningMechanism is a subclass of <a class="reference internal" href="LearningMechanism.html"><span class="doc">Learning Mechanism</span></a>, modified for use with a
---
> <p>An AutoAssociativeLearningMechanism is a subclass of <a class="reference internal" href="LearningMechanism.html"><span class="doc">LearningMechanism</span></a>, modified for use with a
239c239
< <p>An AutoAssociativeLearningMechanism is identical to a <a class="reference internal" href="LearningMechanism.html"><span class="doc">Learning Mechanism</span></a> in all respects except the following:</p>
---
> <p>An AutoAssociativeLearningMechanism is identical to a <a class="reference internal" href="LearningMechanism.html"><span class="doc">LearningMechanism</span></a> in all respects except the following:</p>
257c257
< to the weight change matrix;  as with a standard <a class="reference internal" href="LearningMechanism.html"><span class="doc">Learning Mechanism</span></a>, a scalar can also be specified to scale
---
> to the weight change matrix;  as with a standard <a class="reference internal" href="LearningMechanism.html"><span class="doc">LearningMechanism</span></a>, a scalar can also be specified to scale
265c265
< <p>An AutoAssociativeLearningMechanism executes in the same manner as standard <a class="reference internal" href="LearningMechanism.html"><span class="doc">Learning Mechanism</span></a>, with two exceptions:
---
> <p>An AutoAssociativeLearningMechanism executes in the same manner as standard <a class="reference internal" href="LearningMechanism.html"><span class="doc">LearningMechanism</span></a>, with two exceptions:
282c282
< <dd><p>Implements a <a class="reference internal" href="LearningMechanism.html"><span class="doc">Learning Mechanism</span></a> that modifies the <a class="reference internal" href="MappingProjection.html#psyneulink.core.components.projections.pathway.mappingprojection.MappingProjection.matrix" title="psyneulink.core.components.projections.pathway.mappingprojection.MappingProjection.matrix"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">matrix</span></code></a> parameter of an
---
> <dd><p>Implements a <a class="reference internal" href="LearningMechanism.html"><span class="doc">LearningMechanism</span></a> that modifies the <a class="reference internal" href="MappingProjection.html#psyneulink.core.components.projections.pathway.mappingprojection.MappingProjection.matrix" title="psyneulink.core.components.projections.pathway.mappingprojection.MappingProjection.matrix"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">matrix</span></code></a> parameter of an
418c418
< <a class="reference internal" href="LearningMechanism.html"><span class="doc">Learning Mechanism</span></a>, it can be assigned additional LearningSignals and/or LearningProjections to train
---
> <a class="reference internal" href="LearningMechanism.html"><span class="doc">LearningMechanism</span></a>, it can be assigned additional LearningSignals and/or LearningProjections to train
diff -r docs-base/AutodiffComposition.html docs-head/AutodiffComposition.html
389,391c389,392
< <li><p><strong>num_trials</strong> (<em>int</em><em> (</em><em>default=None</em><em>)</em>) – typically, the composition will infer the number of trials from the length of its input specification.
< To reuse the same inputs across many trials, you may specify an input dictionary with lists of length 1,
< or use default inputs, and select a number of trials with num_trials.</p></li>
---
> <li><p><strong>num_trials</strong> (<em>int</em><em> (</em><em>default=None</em><em>)</em>) – typically, the Composition infers the number of trials to execute from the length of its input
> specification.  However, <strong>num_trials</strong> can be used to enforce an exact number of trials to execute;
> if it is greater than there are inputs then inputs will be repeated (see <a class="reference internal" href="Composition.html#composition-execution-inputs"><span class="std std-ref">Input formats (including targets for learning)</span></a>
> for additional information).</p></li>
diff -r docs-base/BasicsAndPrimer.html docs-head/BasicsAndPrimer.html
971c971
< <p>PsyNeuLink has a native class – <a class="reference internal" href="LearningMechanism.html"><span class="doc">Learning Mechanism</span></a> – that can be used to implement various forms of learning,
---
> <p>PsyNeuLink has a native class – <a class="reference internal" href="LearningMechanism.html"><span class="doc">LearningMechanism</span></a> – that can be used to implement various forms of learning,
1119c1119
< <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
---
> <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
diff -r docs-base/CombinationFunctions.html docs-head/CombinationFunctions.html
223c223
< <dd><p id="concatenate">Concatenates items in outer dimension (axis 0) of of <code class="xref any docutils literal notranslate"><span class="pre">variable</span></code> into a single array,
---
> <dd><p id="concatenate">Concatenates items in outer dimension (axis 0) of <code class="xref any docutils literal notranslate"><span class="pre">variable</span></code> into a single array,
225c225
< <p><code class="xref any docutils literal notranslate"><span class="pre">function</span></code> returns a 1d array with lenght equal to the sum of the lengths of the items
---
> <p><code class="xref any docutils literal notranslate"><span class="pre">function</span></code> returns a 1d array with length equal to the sum of the lengths of the items
diff -r docs-base/Component.html docs-head/Component.html
1190a1191,1210
> <dl class="py method">
> <dt class="sig sig-object py" id="psyneulink.core.components.component.Component.all_dependent_parameters">
> <span class="sig-name descname"><span class="pre">all_dependent_parameters</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filter_name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">filter_regex</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#psyneulink.core.components.component.Component.all_dependent_parameters" title="Permalink to this definition">¶</a></dt>
> <dd><p>Dictionary of Parameters of this Component and its         <a class="reference internal" href="#psyneulink.core.components.component.Component._dependent_components" title="psyneulink.core.components.component.Component._dependent_components"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">_dependent_components</span></code></a> filtered by <strong>filter_name</strong> and         <strong>filter_regex</strong>. If no filter is specified, all Parameters         are included.</p>
> <dl class="field-list simple">
> <dt class="field-odd">Parameters</dt>
> <dd class="field-odd"><ul class="simple">
> <li><p><strong>filter_name</strong> (<em>Union</em><em>[</em><em>str</em><em>, </em><em>Iterable</em><em>[</em><em>str</em><em>]</em><em>]</em><em>, </em><em>optional</em>) – The                 exact name or names of Parameters to include. Defaults                 to None.</p></li>
> <li><p><strong>filter_regex</strong> (<em>Union</em><em>[</em><em>str</em><em>, </em><em>Iterable</em><em>[</em><em>str</em><em>]</em><em>]</em><em>, </em><em>optional</em>) – Regular expression patterns. If any pattern matches a                 Parameter name (using re.match), it will be included                 in the result. Defaults to None.</p></li>
> </ul>
> </dd>
> <dt class="field-even">Returns</dt>
> <dd class="field-even"><p>Component]: Dictionary of filtered Parameters</p>
> </dd>
> <dt class="field-odd">Return type</dt>
> <dd class="field-odd"><p>dict[<a class="reference internal" href="Parameters.html#psyneulink.core.globals.parameters.Parameter" title="psyneulink.core.globals.parameters.Parameter">Parameter</a></p>
> </dd>
> </dl>
> </dd></dl>
> 
diff -r docs-base/Composition.html docs-head/Composition.html
207a208
> <li class="toctree-l1"><a class="reference internal" href="ParameterEstimationComposition.html">ParameterEstimationComposition</a></li>
628,631c629,632
< <p>A Composition can be assigned a <a class="reference internal" href="#psyneulink.core.compositions.composition.Composition.controller" title="psyneulink.core.compositions.composition.Composition.controller"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">controller</span></code></a>.  This is a <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanism</span></a>, or a subclass of
< one, that modulates the parameters of Components within the Composition (including Components of nested Compositions).
< It typically does this based on the output of an <a class="reference internal" href="ObjectiveMechanism.html"><span class="doc">ObjectiveMechanism</span></a> that evaluates the value of other Mechanisms in
< the Composition, and provides the result to the <a class="reference internal" href="#psyneulink.core.compositions.composition.Composition.controller" title="psyneulink.core.compositions.composition.Composition.controller"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">controller</span></code></a>.</p>
---
> <p>A Composition can be assigned a <a class="reference internal" href="#psyneulink.core.compositions.composition.Composition.controller" title="psyneulink.core.compositions.composition.Composition.controller"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">controller</span></code></a>.  This must be an <a class="reference internal" href="OptimizationControlMechanism.html"><span class="doc">OptimizationControlMechanism</span></a>,
> or a subclass of one, that modulates the parameters of Components within the Composition (including Components of
> nested Compositions). It typically does this based on the output of an <a class="reference internal" href="ObjectiveMechanism.html"><span class="doc">ObjectiveMechanism</span></a> that evaluates the value
> of other Mechanisms in the Composition, and provides the result to the <a class="reference internal" href="#psyneulink.core.compositions.composition.Composition.controller" title="psyneulink.core.compositions.composition.Composition.controller"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">controller</span></code></a>.</p>
639,645c640,652
< <p>The <a class="reference internal" href="#psyneulink.core.compositions.composition.Composition.controller" title="psyneulink.core.compositions.composition.Composition.controller"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">controller</span></code></a> is executed only if the Composition’s <a class="reference internal" href="#psyneulink.core.compositions.composition.Composition.enable_controller" title="psyneulink.core.compositions.composition.Composition.enable_controller"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_controller</span></code></a> attribute is True.  This generally done automatically when the <a class="reference internal" href="#psyneulink.core.compositions.composition.Composition.controller" title="psyneulink.core.compositions.composition.Composition.controller"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">controller</span></code></a> is <a class="reference internal" href="#composition-controller-assignment"><span class="std std-ref">assigned</span></a>.  If enabled, the <a class="reference internal" href="#psyneulink.core.compositions.composition.Composition.controller" title="psyneulink.core.compositions.composition.Composition.controller"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">controller</span></code></a> is generally executed either before or after all of the other Components in the Composition
< have been executed within a given <a class="reference internal" href="Time.html#psyneulink.core.scheduling.time.TimeScale" title="psyneulink.core.scheduling.time.TimeScale"><code class="xref any py py-class docutils literal notranslate"><span class="pre">TimeScale</span></code></a>, as determined by the Composition’s
< <code class="xref any docutils literal notranslate"><span class="pre">controller_time_scale</span></code> and <a class="reference internal" href="#psyneulink.core.compositions.composition.Composition.controller_mode" title="psyneulink.core.compositions.composition.Composition.controller_mode"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">controller_mode</span></code></a> attributes. The Composition’s
< <a class="reference internal" href="#psyneulink.core.compositions.composition.Composition.controller_condition" title="psyneulink.core.compositions.composition.Composition.controller_condition"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">controller_condition</span></code></a> attribute can be used to further customize when it is
< executed. All three of these attributes can be specified in corresponding arguments of the
< Composition’s constructor, or programmatically after it is constructed by assigning the desired value to the
< corresponding attribute.</p>
---
> <p>The <a class="reference internal" href="#psyneulink.core.compositions.composition.Composition.controller" title="psyneulink.core.compositions.composition.Composition.controller"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">controller</span></code></a> is executed only if the Composition’s <a class="reference internal" href="#psyneulink.core.compositions.composition.Composition.enable_controller" title="psyneulink.core.compositions.composition.Composition.enable_controller"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_controller</span></code></a> attribute is True.  This is generally done automatically when the controller is
> is <a class="reference internal" href="#composition-controller-assignment"><span class="std std-ref">assigned</span></a>.  If <a class="reference internal" href="#psyneulink.core.compositions.composition.Composition.enable_controller" title="psyneulink.core.compositions.composition.Composition.enable_controller"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enabled</span></code></a>, the controller is
> executed either before or after all of the other Components in the Composition have been executed at a given
> <a class="reference internal" href="Time.html#psyneulink.core.scheduling.time.TimeScale" title="psyneulink.core.scheduling.time.TimeScale"><code class="xref any py py-class docutils literal notranslate"><span class="pre">TimeScale</span></code></a>, and if its specified <a class="reference internal" href="#psyneulink.core.compositions.composition.Composition.controller_condition" title="psyneulink.core.compositions.composition.Composition.controller_condition"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">Condition</span></code></a> has been met, as determined by the
> Composition’s <a class="reference internal" href="#psyneulink.core.compositions.composition.Composition.controller_mode" titl
...

See CI logs for the full diff.

@kmantel
Copy link
Collaborator

kmantel commented Dec 3, 2021

Here's a comparison for the figures produced:
Fig 1:

devel
Figure_1-devel
pr
Figure_1-pr2222

Fig 2:

devel
Figure_2-devel
pr
Figure_2-pr2222

I don't know a correct comparison for Fig 1, but Fig 2 is in the original paper:
cohen huston figure

While it looks to me that the reaction times in Fig 2 devel match the paper more closely, I'm not sure if this was part of the motivation. Thoughts on this @jdcpni @tylergiallanza?

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Dec 3, 2021

This pull request fixes 4 alerts when merging 0788f44 into a1d4f2a - view on LGTM.com

fixed alerts:

  • 4 for Variable defined multiple times

@JeshuaT
Copy link
Author

JeshuaT commented Dec 6, 2021

The motivation to change the script was because the weights before and after the initialization run were not set correctly! Thus, the first graphs are produced with the weights between colour/word and response on 0 for both initialization and actual runs. That is by design incorrect, thus the graphs can't really be compared in that regard.

@kmantel
Copy link
Collaborator

kmantel commented Dec 7, 2021

The motivation to change the script was because the weights before and after the initialization run were not set correctly! Thus, the first graphs are produced with the weights between colour/word and response on 0 for both initialization and actual runs. That is by design incorrect, thus the graphs can't really be compared in that regard.

Fair, but this suggests to me that there are additional errors somewhere. If the script is meant to replicate the original model, then it should match the reaction times. It seems that either the original simulation was also incorrect in the same way, though this seems unlikely in part due to its matching the empirical data, or that there are additional changes that need to be made to the script with weights set for post-initialization runs to bring the results in line with the paper.

@JeshuaT
Copy link
Author

JeshuaT commented Dec 7, 2021

In the original Psyneulink paper, to get to the results of the 1994 model, some changes needed to be made to several key parameters deviating from the 1994 model:

  • integration rate from 0.01 to 0.1
  • threshold from 0.6 to 0.55

Changing that back to the 1994 parameter setting in the original Psyneulink script leads to a never-ending simulation since the threshold can't be reached. In the new script I propose I'm able to keep the 1994 parameter values, whilst replicating the 1994 results. Not exactly though, since this script runs a single noiseless simulation, whilst the 1994 results show a noise-infused average of 100 trials.

@jdcpni
Copy link
Collaborator

jdcpni commented Dec 8, 2021 via email

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.

3 participants