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

Fix/one hot max indicator #3079

Merged
merged 26 commits into from
Oct 25, 2024
Merged

Fix/one hot max indicator #3079

merged 26 commits into from
Oct 25, 2024

Conversation

jdcpni
Copy link
Collaborator

@jdcpni jdcpni commented Oct 23, 2024

• transferfunctions.py
  - OneHot:
    - add ARG_MAX_ABS, ARG_MAX_ABS_INDICATOR, ARG_MIN_ABS, ARG_MIN_ABS_INDICATOR
    - change default mode to ARG_MAX
    - relabel options for _gen_llvm from XXX_VAL to ARG_XXX (former need to be implemented)

• memoryfunctions.py
  - DictionaryMemory._gen_llvm_function_body:  replace MIN_VAL with ARG_MIN for selection.function.mode

• emcomposition.py
  - field_inputs_nodes -> input_nodes_by_fields
  - refactor naming of retrieval nodes to
    use input_nodes_by_fields

• test_selection.py
  - test_basic: add tests of OneHot for ARG_XXX
  - exclude LLVM tests for XXX_VAL

• test_transfer.py
  - test_basic: add tests of SoftMax for ARG_XXX
  - exclude LLVM tests for XXX__VAL

• test_emcomposition.py
  - reinstate test_two_calls_no_args

jdcpni added 15 commits July 26, 2024 10:08
  _parse_port_spec():  enhance error message for bad MECHANISM entry in modulatory param specification
  make matrix, auto, hetero and competition params non-modulable until that is implemented
  - OneHot._function: add ARG_MAX, ARG_MAX_INDICATOR, ARG_MIN, ARG_MIN_INDICATOR
  - OneHot:  add arg_max, arg_max_indicator, arg_min, and arg_min_indicator options
  WEIGHTED -> WEIGHTED_AVG
  test warning for ARG_MAX or PROBABILISTIC with enable_learning = True
  - OneHot:
    - add ARG_MAX_ABS, ARG_MAX_ABS_INDICATOR, ARG_MIN_ABS, ARG_MIN_ABS_INDICATOR
    - change default mode to ARG_MAX
    - relabel options for _gen_llvm from XXX_VAL to ARG_XXX

• memoryfunctions.py
  - DictionaryMemory._gen_llvm_function_body:  replace MIN_VAL with ARG_MIN in selection.function.mode

• test_selection.py
  - test_basic: add tests of OneHot for ARG_XXX
  - exclude LLVM tests for XXX_VAL

• test_transfer.py
  - test_basic: add tests of SoftMax for ARG_XXX
  - exclude LLVM tests for XXX__VAL
…Link into fix/one_hot_max_indicator

# Conflicts:
#	psyneulink/core/components/functions/nonstateful/selectionfunctions.py
#	tests/functions/test_selection.py
#	tests/functions/test_transfer.py
• merged in from devel
• test_selection.py:
  test now use llvm_not_implemented for OneHot modes not supported by LLVM
• test_mdf.py:
  problem with mdf using np.object
@@ -85,7 +85,7 @@
get_matrix, is_function_type,
)
from psyneulink.core.components.functions.nonstateful.combinationfunctions import LinearCombination
from psyneulink.core.components.functions.nonstateful.selectionfunctions import OneHot
from psyneulink.core.components.functions.nonstateful.selectionfunctions import OneHot, ARG_MAX, ARG_MAX_INDICATOR

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
psyneulink.core.components.functions.nonstateful.selectionfunctions
begins an import cycle.
Comment on lines +191 to +192
from psyneulink.core.components.functions.nonstateful.selectionfunctions import OneHot, ARG_MAX, ARG_MAX_ABS, \
ARG_MAX_INDICATOR, ARG_MAX_ABS_INDICATOR

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
psyneulink.core.components.functions.nonstateful.selectionfunctions
begins an import cycle.
@@ -5,6 +5,7 @@
from psyneulink.core.components.functions.function import FunctionError
from psyneulink.core.components.functions.stateful.memoryfunctions import DictionaryMemory, \
ContentAddressableMemory
from psyneulink.core.components.functions.nonstateful.selectionfunctions import OneHot, ARG_MIN

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'OneHot' is not used.
Import of 'ARG_MIN' is not used.
Comment on lines +6 to +7
from psyneulink.core.components.functions.nonstateful.selectionfunctions import (
ARG_MAX, ARG_MAX_ABS_INDICATOR, ARG_MAX_INDICATOR)

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'ARG_MAX' is not used.
Import of 'ARG_MAX_ABS_INDICATOR' is not used.
Import of 'ARG_MAX_INDICATOR' is not used.
Copy link

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

diff -r docs-base/EMComposition.html docs-head/EMComposition.html
395,399c395,400
< here there can be one or more keys and any number of values;  if all fields are keys, this implements a full
< form of content-addressable memory. If <strong>learn_field_weight</strong> is True (and <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is either True or a list), then the field_weights can be modified
< during training (this functions similarly to the attention head of a Transformer model, although at present the
< field can only be scalar values rather than vecdtors); if <strong>learn_field_weight</strong> is False, then the field_weights are
< fixed. The following options can be used to specify <strong>field_weights</strong>:</p>
---
> here there can be one or more keys and any number of values;  if all fields are keys, this implements a full form of
> content-addressable memory. If <strong>learn_field_weight</strong> is True (and <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a>
> is either True or a list with True for at least one entry), then the field_weights can be modified during training
> (this functions similarly to the attention head of a Transformer model, although at present the field can only be
> scalar values rather than vecdtors); if <strong>learn_field_weight</strong> is False, then the field_weights are fixed.
> The following options can be used to specify <strong>field_weights</strong>:</p>
494,495c495,496
< <li><p><em>WEIGHTED</em>: softmax-weighted average of entries, based on their dot products with the key(s); this is the default;</p></li>
< <li><p><em>ARG_MAX</em>: entry with the largest dot product.</p></li>
---
> <li><p><em>WEIGHTED_AVG</em> (default): softmax-weighted average of entries, based on their dot products with the key(s).</p></li>
> <li><p><em>ARG_MAX</em>: entry with the largest dot product (one with lowest index in <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.memory" title="psyneulink.library.compositions.emcomposition.EMComposition.memory"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">memory</span></code></a>)               if there are identical ones).</p></li>
502,503c503,505
< these options and <strong>enable_learning</strong> set to True will generate a warning, and calling the EMComposition’s
< <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method will generate an error; it must be changed to <em>WEIGHTED</em> to execute learning.</p>
---
> these options and <strong>enable_learning</strong> set to True (or a list with any True entries) will generate a warning, and
> calling the EMComposition’s <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method will generate an error; it must be changed to
> <em>WEIGHTED_AVG</em> to execute learning.</p>
506,507c508,510
< <p>The <em>WEIGHTED</em> option is passed as <em>ALL</em> to the <strong>output</strong> argument of the <a class="reference internal" href="TransferFunctions.html#psyneulink.core.components.functions.transferfunctions.SoftMax" title="psyneulink.core.components.functions.transferfunctions.SoftMax"><code class="xref any py py-class docutils literal notranslate"><span class="pre">SoftMax</span></code></a> Function, <em>ARG_MAX</em> is
< passed as <em>MAX_INDICATOR</em>; <em>PROBALISTIC</em> is passed as <em>PROB_INDICATOR</em>; and <em>MAX_VAL</em> is not currently supported.</p>
---
> <p>The <em>WEIGHTED_AVG</em> option is passed as <em>ALL</em> to the <strong>output</strong> argument of the <a class="reference internal" href="TransferFunctions.html#psyneulink.core.components.functions.transferfunctions.SoftMax" title="psyneulink.core.components.functions.transferfunctions.SoftMax"><code class="xref any py py-class docutils literal notranslate"><span class="pre">SoftMax</span></code></a> Function, <em>ARG_MAX</em> is
> passed as <em>ARG_MAX_INDICATOR</em>; and <em>PROBALISTIC</em> is passed as <em>PROB_INDICATOR</em>; the other SoftMax options are
> not currently supported.</p>
656,657c659,660
< <p>If <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> is called, <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is True or a list with at
< least one True entry, then errors will be computed for each of the <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">retrieved_nodes</span></code></a>
---
> <p>If <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> is called, <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is True or a list with
> any True entries, then errors will be computed for each of the <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">retrieved_nodes</span></code></a>
858c861
< <li><p><strong>softmax_choice</strong> (<em>WEIGHTED</em><em>, </em><em>ARG_MAX</em><em>, </em><em>PROBABILISTIC : default WEIGHTED</em>) – specifies how the softmax over dot products of keys and memories is used for retrieval;
---
> <li><p><strong>softmax_choice</strong> (<em>WEIGHTED_AVG</em><em>, </em><em>ARG_MAX</em><em>, </em><em>PROBABILISTIC : default WEIGHTED_AVG</em>) – specifies how the softmax over dot products of keys and memories is used for retrieval;
1015c1018
< <dd class="field-odd"><p>WEIGHTED, ARG_MAX or PROBABILISTIC</p>
---
> <dd class="field-odd"><p>WEIGHTED_AVG, ARG_MAX or PROBABILISTIC</p>
1064,1065c1067,1068
< requires <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> to be True for the corresponding field;
< see <a class="reference internal" href="#emcomposition-learning"><span class="std std-ref">Learning</span></a> for additional details.</p>
---
> requires <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> to be True or a list with at least one True
> entry for the corresponding field; see <a class="reference internal" href="#emcomposition-learning"><span class="std std-ref">Learning</span></a> for additional details.</p>
1561,1566c1564
< <dd><p>Override to handle synch and retain args
< Note: defaults for synch and retain args are set to NotImplemented, so that the user can specify None if</p>
< <blockquote>
< <div><p>they want to locally override the default values for the AutodiffComposition (see docstrings for run()
< and _parse_synch_and_retain_args() for additonal details).</p>
< </div></blockquote>
---
> <dd><p>Override to check for inappropriate use of ARG_MAX or PROBABILISTIC options for retrieval with learning</p>
diff -r docs-base/MemoryFunctions.html docs-head/MemoryFunctions.html
438c438
< <li><p><strong>selection_function</strong> (<a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot"><em>OneHot</em></a><em> or </em><em>function : default OneHot</em><em>(</em><em>mode=MIN_VAL</em><em>)</em>) – specifies the function used during retrieval to evaluate the distances returned by <a class="reference internal" href="#psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function" title="psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">distance_function</span></code></a> and select the item to return.</p></li>
---
> <li><p><strong>selection_function</strong> (<a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot"><em>OneHot</em></a><em> or </em><em>function : default OneHot</em><em>(</em><em>mode=ARG_MIN_VAL</em><em>)</em>) – specifies the function used during retrieval to evaluate the distances returned by <a class="reference internal" href="#psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function" title="psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">distance_function</span></code></a> and select the item to return.</p></li>
575c575
< <dd class="field-odd"><p><a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot">OneHot</a> or function : default OneHot(mode=MIN_VAL)</p>
---
> <dd class="field-odd"><p><a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot">OneHot</a> or function : default OneHot(mode=ARG_MIN_VAL)</p>
diff -r docs-base/SelectionFunctions.html docs-head/SelectionFunctions.html
219,220c219,220
< with all of its values zeroed except one identified in first item <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.variable" title="psyneulink.core.components.functions.selectionfunctions.OneHot.variable"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">variable</span></code></a> as specified by
< <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.mode" title="psyneulink.core.components.functions.selectionfunctions.OneHot.mode"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mode</span></code></a>:</p>
---
> with all of its values zeroed except one, unless there are ties, which are handled according to the choice of
> <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.mode" title="psyneulink.core.components.functions.selectionfunctions.OneHot.mode"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mode</span></code></a>, as follows:</p>
223,232c223,256
< <li><p><em>MAX_VAL</em>: signed value of the element with the maximum signed value;</p></li>
< <li><p><em>MAX_ABS_VAL</em>: absolute value of the element with the maximum absolute value;</p></li>
< <li><p><em>MAX_INDICATOR</em>: 1 in place of the element with the maximum signed value;</p></li>
< <li><p><em>MAX_ABS_INDICATOR</em>: 1 in place of the element with the maximum absolute value;</p></li>
< <li><p><em>MIN_VAL</em>: signed value of the element with the minimum signed value;</p></li>
< <li><p><em>MIN_ABS_VAL</em>: absolute value of element with the minimum absolute value;</p></li>
< <li><p><em>MIN_INDICATOR</em>: 1 in place of the element with the minimum signed value;</p></li>
< <li><p><em>MIN_ABS_INDICATOR</em>: 1 in place of the element with the minimum absolute value;</p></li>
< <li><p><em>PROB</em>: value of probabilistically chosen element based on probabilities passed in second item of variable;</p></li>
< <li><p><em>PROB_INDICATOR</em>: same as <em>PROB</em> but chosen item is assigned a value of 1.</p></li>
---
> <li><p><em>ARG_MAX</em>: signed value of a single element with the maximum signed value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MAX_ABS</em>: absolute value of a single element with the maximum absolute value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MAX_INDICATOR</em>: 1 in place of single element with maximum signed value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MAX_ABS_INDICATOR</em>: 1 in place of single element with maximum absolute value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>MAX_VAL</em>: signed value of the element with the maximum signed value,
> or all elements with the maximum value if there are ties.</p></li>
> <li><p><em>MAX_ABS_VAL</em>: absolute value of the element with the maximum absolute value,
> or all elements with the maximum value if there are ties.</p></li>
> <li><p><em>MAX_INDICATOR</em>: 1 in place of the element with the maximum signed value,
> or all elements with the maximum value if there are ties.</p></li>
> <li><p><em>MAX_ABS_INDICATOR</em>: 1 in place of the element(s) with the maximum absolute value,
> or all elements with the maximum value if there are ties.</p></li>
> <li><p><em>ARG_MIN</em>: signed value of a single element with the minium signed value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MIN_ABS</em>: absolute value of a single element with the minium absolute value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MIN_INDICATOR</em>: 1 in place of single element with minimum signed value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>MIN_VAL</em>: signed value of the element with the minimum signed value,
> or all elements with the minimum value if there are ties.</p></li>
> <li><p><em>MIN_ABS_VAL</em>: absolute value of element with the minimum absolute value,
> or all elements with the minimum value if there are ties.</p></li>
> <li><p><em>MIN_INDICATOR</em>: 1 in place of the element with the minimum signed value,
> or all elements with the minimum value if there are ties.</p></li>
> <li><p><em>MIN_ABS_INDICATOR</em>: 1 in place of the element with the minimum absolute value,
> or all elements with the minimum value if there are ties.</p></li>
> <li><p><em>PROB</em>: value of probabilistically chosen element based on probabilities passed in second item of variable;
> if 
...

See CI logs for the full diff.

  - move ARG_XXX keywords to keywords.py
Copy link

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

diff -r docs-base/EMComposition.html docs-head/EMComposition.html
395,399c395,400
< here there can be one or more keys and any number of values;  if all fields are keys, this implements a full
< form of content-addressable memory. If <strong>learn_field_weight</strong> is True (and <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is either True or a list), then the field_weights can be modified
< during training (this functions similarly to the attention head of a Transformer model, although at present the
< field can only be scalar values rather than vecdtors); if <strong>learn_field_weight</strong> is False, then the field_weights are
< fixed. The following options can be used to specify <strong>field_weights</strong>:</p>
---
> here there can be one or more keys and any number of values;  if all fields are keys, this implements a full form of
> content-addressable memory. If <strong>learn_field_weight</strong> is True (and <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a>
> is either True or a list with True for at least one entry), then the field_weights can be modified during training
> (this functions similarly to the attention head of a Transformer model, although at present the field can only be
> scalar values rather than vecdtors); if <strong>learn_field_weight</strong> is False, then the field_weights are fixed.
> The following options can be used to specify <strong>field_weights</strong>:</p>
494,495c495,496
< <li><p><em>WEIGHTED</em>: softmax-weighted average of entries, based on their dot products with the key(s); this is the default;</p></li>
< <li><p><em>ARG_MAX</em>: entry with the largest dot product.</p></li>
---
> <li><p><em>WEIGHTED_AVG</em> (default): softmax-weighted average of entries, based on their dot products with the key(s).</p></li>
> <li><p><em>ARG_MAX</em>: entry with the largest dot product (one with lowest index in <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.memory" title="psyneulink.library.compositions.emcomposition.EMComposition.memory"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">memory</span></code></a>)               if there are identical ones).</p></li>
502,503c503,505
< these options and <strong>enable_learning</strong> set to True will generate a warning, and calling the EMComposition’s
< <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method will generate an error; it must be changed to <em>WEIGHTED</em> to execute learning.</p>
---
> these options and <strong>enable_learning</strong> set to True (or a list with any True entries) will generate a warning, and
> calling the EMComposition’s <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method will generate an error; it must be changed to
> <em>WEIGHTED_AVG</em> to execute learning.</p>
506,507c508,510
< <p>The <em>WEIGHTED</em> option is passed as <em>ALL</em> to the <strong>output</strong> argument of the <a class="reference internal" href="TransferFunctions.html#psyneulink.core.components.functions.transferfunctions.SoftMax" title="psyneulink.core.components.functions.transferfunctions.SoftMax"><code class="xref any py py-class docutils literal notranslate"><span class="pre">SoftMax</span></code></a> Function, <em>ARG_MAX</em> is
< passed as <em>MAX_INDICATOR</em>; <em>PROBALISTIC</em> is passed as <em>PROB_INDICATOR</em>; and <em>MAX_VAL</em> is not currently supported.</p>
---
> <p>The <em>WEIGHTED_AVG</em> option is passed as <em>ALL</em> to the <strong>output</strong> argument of the <a class="reference internal" href="TransferFunctions.html#psyneulink.core.components.functions.transferfunctions.SoftMax" title="psyneulink.core.components.functions.transferfunctions.SoftMax"><code class="xref any py py-class docutils literal notranslate"><span class="pre">SoftMax</span></code></a> Function, <em>ARG_MAX</em> is
> passed as <em>ARG_MAX_INDICATOR</em>; and <em>PROBALISTIC</em> is passed as <em>PROB_INDICATOR</em>; the other SoftMax options are
> not currently supported.</p>
656,657c659,660
< <p>If <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> is called, <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is True or a list with at
< least one True entry, then errors will be computed for each of the <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">retrieved_nodes</span></code></a>
---
> <p>If <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> is called, <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is True or a list with
> any True entries, then errors will be computed for each of the <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">retrieved_nodes</span></code></a>
858c861
< <li><p><strong>softmax_choice</strong> (<em>WEIGHTED</em><em>, </em><em>ARG_MAX</em><em>, </em><em>PROBABILISTIC : default WEIGHTED</em>) – specifies how the softmax over dot products of keys and memories is used for retrieval;
---
> <li><p><strong>softmax_choice</strong> (<em>WEIGHTED_AVG</em><em>, </em><em>ARG_MAX</em><em>, </em><em>PROBABILISTIC : default WEIGHTED_AVG</em>) – specifies how the softmax over dot products of keys and memories is used for retrieval;
1015c1018
< <dd class="field-odd"><p>WEIGHTED, ARG_MAX or PROBABILISTIC</p>
---
> <dd class="field-odd"><p>WEIGHTED_AVG, ARG_MAX or PROBABILISTIC</p>
1064,1065c1067,1068
< requires <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> to be True for the corresponding field;
< see <a class="reference internal" href="#emcomposition-learning"><span class="std std-ref">Learning</span></a> for additional details.</p>
---
> requires <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> to be True or a list with at least one True
> entry for the corresponding field; see <a class="reference internal" href="#emcomposition-learning"><span class="std std-ref">Learning</span></a> for additional details.</p>
1561,1566c1564
< <dd><p>Override to handle synch and retain args
< Note: defaults for synch and retain args are set to NotImplemented, so that the user can specify None if</p>
< <blockquote>
< <div><p>they want to locally override the default values for the AutodiffComposition (see docstrings for run()
< and _parse_synch_and_retain_args() for additonal details).</p>
< </div></blockquote>
---
> <dd><p>Override to check for inappropriate use of ARG_MAX or PROBABILISTIC options for retrieval with learning</p>
diff -r docs-base/MemoryFunctions.html docs-head/MemoryFunctions.html
438c438
< <li><p><strong>selection_function</strong> (<a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot"><em>OneHot</em></a><em> or </em><em>function : default OneHot</em><em>(</em><em>mode=MIN_VAL</em><em>)</em>) – specifies the function used during retrieval to evaluate the distances returned by <a class="reference internal" href="#psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function" title="psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">distance_function</span></code></a> and select the item to return.</p></li>
---
> <li><p><strong>selection_function</strong> (<a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot"><em>OneHot</em></a><em> or </em><em>function : default OneHot</em><em>(</em><em>mode=ARG_MIN_VAL</em><em>)</em>) – specifies the function used during retrieval to evaluate the distances returned by <a class="reference internal" href="#psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function" title="psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">distance_function</span></code></a> and select the item to return.</p></li>
575c575
< <dd class="field-odd"><p><a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot">OneHot</a> or function : default OneHot(mode=MIN_VAL)</p>
---
> <dd class="field-odd"><p><a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot">OneHot</a> or function : default OneHot(mode=ARG_MIN_VAL)</p>
diff -r docs-base/SelectionFunctions.html docs-head/SelectionFunctions.html
219,220c219,220
< with all of its values zeroed except one identified in first item <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.variable" title="psyneulink.core.components.functions.selectionfunctions.OneHot.variable"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">variable</span></code></a> as specified by
< <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.mode" title="psyneulink.core.components.functions.selectionfunctions.OneHot.mode"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mode</span></code></a>:</p>
---
> with all of its values zeroed except one, unless there are ties, which are handled according to the choice of
> <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.mode" title="psyneulink.core.components.functions.selectionfunctions.OneHot.mode"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mode</span></code></a>, as follows:</p>
223,232c223,256
< <li><p><em>MAX_VAL</em>: signed value of the element with the maximum signed value;</p></li>
< <li><p><em>MAX_ABS_VAL</em>: absolute value of the element with the maximum absolute value;</p></li>
< <li><p><em>MAX_INDICATOR</em>: 1 in place of the element with the maximum signed value;</p></li>
< <li><p><em>MAX_ABS_INDICATOR</em>: 1 in place of the element with the maximum absolute value;</p></li>
< <li><p><em>MIN_VAL</em>: signed value of the element with the minimum signed value;</p></li>
< <li><p><em>MIN_ABS_VAL</em>: absolute value of element with the minimum absolute value;</p></li>
< <li><p><em>MIN_INDICATOR</em>: 1 in place of the element with the minimum signed value;</p></li>
< <li><p><em>MIN_ABS_INDICATOR</em>: 1 in place of the element with the minimum absolute value;</p></li>
< <li><p><em>PROB</em>: value of probabilistically chosen element based on probabilities passed in second item of variable;</p></li>
< <li><p><em>PROB_INDICATOR</em>: same as <em>PROB</em> but chosen item is assigned a value of 1.</p></li>
---
> <li><p><em>ARG_MAX</em>: signed value of a single element with the maximum signed value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MAX_ABS</em>: absolute value of a single element with the maximum absolute value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MAX_INDICATOR</em>: 1 in place of single element with maximum signed value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MAX_ABS_INDICATOR</em>: 1 in place of single element with maximum absolute value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>MAX_VAL</em>: signed value of the element with the maximum signed value,
> or all elements with the maximum value if there are ties.</p></li>
> <li><p><em>MAX_ABS_VAL</em>: absolute value of the element with the maximum absolute value,
> or all elements with the maximum value if there are ties.</p></li>
> <li><p><em>MAX_INDICATOR</em>: 1 in place of the element with the maximum signed value,
> or all elements with the maximum value if there are ties.</p></li>
> <li><p><em>MAX_ABS_INDICATOR</em>: 1 in place of the element(s) with the maximum absolute value,
> or all elements with the maximum value if there are ties.</p></li>
> <li><p><em>ARG_MIN</em>: signed value of a single element with the minium signed value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MIN_ABS</em>: absolute value of a single element with the minium absolute value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MIN_INDICATOR</em>: 1 in place of single element with minimum signed value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>MIN_VAL</em>: signed value of the element with the minimum signed value,
> or all elements with the minimum value if there are ties.</p></li>
> <li><p><em>MIN_ABS_VAL</em>: absolute value of element with the minimum absolute value,
> or all elements with the minimum value if there are ties.</p></li>
> <li><p><em>MIN_INDICATOR</em>: 1 in place of the element with the minimum signed value,
> or all elements with the minimum value if there are ties.</p></li>
> <li><p><em>MIN_ABS_INDICATOR</em>: 1 in place of the element with the minimum absolute value,
> or all elements with the minimum value if there are ties.</p></li>
> <li><p><em>PROB</em>: value of probabilistically chosen element based on probabilities passed in second item of variable;
> if 
...

See CI logs for the full diff.

@coveralls
Copy link

coveralls commented Oct 23, 2024

Coverage Status

coverage: 83.698% (+0.02%) from 83.68%
when pulling 6c70e08 on fix/one_hot_max_indicator
into 260f955 on devel.

Copy link

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

diff -r docs-base/EMComposition.html docs-head/EMComposition.html
395,399c395,400
< here there can be one or more keys and any number of values;  if all fields are keys, this implements a full
< form of content-addressable memory. If <strong>learn_field_weight</strong> is True (and <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is either True or a list), then the field_weights can be modified
< during training (this functions similarly to the attention head of a Transformer model, although at present the
< field can only be scalar values rather than vecdtors); if <strong>learn_field_weight</strong> is False, then the field_weights are
< fixed. The following options can be used to specify <strong>field_weights</strong>:</p>
---
> here there can be one or more keys and any number of values;  if all fields are keys, this implements a full form of
> content-addressable memory. If <strong>learn_field_weight</strong> is True (and <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a>
> is either True or a list with True for at least one entry), then the field_weights can be modified during training
> (this functions similarly to the attention head of a Transformer model, although at present the field can only be
> scalar values rather than vecdtors); if <strong>learn_field_weight</strong> is False, then the field_weights are fixed.
> The following options can be used to specify <strong>field_weights</strong>:</p>
494,495c495,496
< <li><p><em>WEIGHTED</em>: softmax-weighted average of entries, based on their dot products with the key(s); this is the default;</p></li>
< <li><p><em>ARG_MAX</em>: entry with the largest dot product.</p></li>
---
> <li><p><em>WEIGHTED_AVG</em> (default): softmax-weighted average of entries, based on their dot products with the key(s).</p></li>
> <li><p><em>ARG_MAX</em>: entry with the largest dot product (one with lowest index in <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.memory" title="psyneulink.library.compositions.emcomposition.EMComposition.memory"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">memory</span></code></a>)               if there are identical ones).</p></li>
502,503c503,505
< these options and <strong>enable_learning</strong> set to True will generate a warning, and calling the EMComposition’s
< <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method will generate an error; it must be changed to <em>WEIGHTED</em> to execute learning.</p>
---
> these options and <strong>enable_learning</strong> set to True (or a list with any True entries) will generate a warning, and
> calling the EMComposition’s <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method will generate an error; it must be changed to
> <em>WEIGHTED_AVG</em> to execute learning.</p>
506,507c508,510
< <p>The <em>WEIGHTED</em> option is passed as <em>ALL</em> to the <strong>output</strong> argument of the <a class="reference internal" href="TransferFunctions.html#psyneulink.core.components.functions.transferfunctions.SoftMax" title="psyneulink.core.components.functions.transferfunctions.SoftMax"><code class="xref any py py-class docutils literal notranslate"><span class="pre">SoftMax</span></code></a> Function, <em>ARG_MAX</em> is
< passed as <em>MAX_INDICATOR</em>; <em>PROBALISTIC</em> is passed as <em>PROB_INDICATOR</em>; and <em>MAX_VAL</em> is not currently supported.</p>
---
> <p>The <em>WEIGHTED_AVG</em> option is passed as <em>ALL</em> to the <strong>output</strong> argument of the <a class="reference internal" href="TransferFunctions.html#psyneulink.core.components.functions.transferfunctions.SoftMax" title="psyneulink.core.components.functions.transferfunctions.SoftMax"><code class="xref any py py-class docutils literal notranslate"><span class="pre">SoftMax</span></code></a> Function, <em>ARG_MAX</em> is
> passed as <em>ARG_MAX_INDICATOR</em>; and <em>PROBALISTIC</em> is passed as <em>PROB_INDICATOR</em>; the other SoftMax options are
> not currently supported.</p>
656,657c659,660
< <p>If <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> is called, <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is True or a list with at
< least one True entry, then errors will be computed for each of the <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">retrieved_nodes</span></code></a>
---
> <p>If <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> is called, <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is True or a list with
> any True entries, then errors will be computed for each of the <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">retrieved_nodes</span></code></a>
858c861
< <li><p><strong>softmax_choice</strong> (<em>WEIGHTED</em><em>, </em><em>ARG_MAX</em><em>, </em><em>PROBABILISTIC : default WEIGHTED</em>) – specifies how the softmax over dot products of keys and memories is used for retrieval;
---
> <li><p><strong>softmax_choice</strong> (<em>WEIGHTED_AVG</em><em>, </em><em>ARG_MAX</em><em>, </em><em>PROBABILISTIC : default WEIGHTED_AVG</em>) – specifies how the softmax over dot products of keys and memories is used for retrieval;
1015c1018
< <dd class="field-odd"><p>WEIGHTED, ARG_MAX or PROBABILISTIC</p>
---
> <dd class="field-odd"><p>WEIGHTED_AVG, ARG_MAX or PROBABILISTIC</p>
1064,1065c1067,1068
< requires <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> to be True for the corresponding field;
< see <a class="reference internal" href="#emcomposition-learning"><span class="std std-ref">Learning</span></a> for additional details.</p>
---
> requires <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> to be True or a list with at least one True
> entry for the corresponding field; see <a class="reference internal" href="#emcomposition-learning"><span class="std std-ref">Learning</span></a> for additional details.</p>
1561,1566c1564
< <dd><p>Override to handle synch and retain args
< Note: defaults for synch and retain args are set to NotImplemented, so that the user can specify None if</p>
< <blockquote>
< <div><p>they want to locally override the default values for the AutodiffComposition (see docstrings for run()
< and _parse_synch_and_retain_args() for additonal details).</p>
< </div></blockquote>
---
> <dd><p>Override to check for inappropriate use of ARG_MAX or PROBABILISTIC options for retrieval with learning</p>
diff -r docs-base/MemoryFunctions.html docs-head/MemoryFunctions.html
438c438
< <li><p><strong>selection_function</strong> (<a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot"><em>OneHot</em></a><em> or </em><em>function : default OneHot</em><em>(</em><em>mode=MIN_VAL</em><em>)</em>) – specifies the function used during retrieval to evaluate the distances returned by <a class="reference internal" href="#psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function" title="psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">distance_function</span></code></a> and select the item to return.</p></li>
---
> <li><p><strong>selection_function</strong> (<a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot"><em>OneHot</em></a><em> or </em><em>function : default OneHot</em><em>(</em><em>mode=ARG_MIN_VAL</em><em>)</em>) – specifies the function used during retrieval to evaluate the distances returned by <a class="reference internal" href="#psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function" title="psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">distance_function</span></code></a> and select the item to return.</p></li>
575c575
< <dd class="field-odd"><p><a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot">OneHot</a> or function : default OneHot(mode=MIN_VAL)</p>
---
> <dd class="field-odd"><p><a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot">OneHot</a> or function : default OneHot(mode=ARG_MIN_VAL)</p>
diff -r docs-base/SelectionFunctions.html docs-head/SelectionFunctions.html
219,220c219,220
< with all of its values zeroed except one identified in first item <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.variable" title="psyneulink.core.components.functions.selectionfunctions.OneHot.variable"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">variable</span></code></a> as specified by
< <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.mode" title="psyneulink.core.components.functions.selectionfunctions.OneHot.mode"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mode</span></code></a>:</p>
---
> with all of its values zeroed except one, unless there are ties, which are handled according to the choice of
> <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.mode" title="psyneulink.core.components.functions.selectionfunctions.OneHot.mode"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mode</span></code></a>, as follows:</p>
223,232c223,256
< <li><p><em>MAX_VAL</em>: signed value of the element with the maximum signed value;</p></li>
< <li><p><em>MAX_ABS_VAL</em>: absolute value of the element with the maximum absolute value;</p></li>
< <li><p><em>MAX_INDICATOR</em>: 1 in place of the element with the maximum signed value;</p></li>
< <li><p><em>MAX_ABS_INDICATOR</em>: 1 in place of the element with the maximum absolute value;</p></li>
< <li><p><em>MIN_VAL</em>: signed value of the element with the minimum signed value;</p></li>
< <li><p><em>MIN_ABS_VAL</em>: absolute value of element with the minimum absolute value;</p></li>
< <li><p><em>MIN_INDICATOR</em>: 1 in place of the element with the minimum signed value;</p></li>
< <li><p><em>MIN_ABS_INDICATOR</em>: 1 in place of the element with the minimum absolute value;</p></li>
< <li><p><em>PROB</em>: value of probabilistically chosen element based on probabilities passed in second item of variable;</p></li>
< <li><p><em>PROB_INDICATOR</em>: same as <em>PROB</em> but chosen item is assigned a value of 1.</p></li>
---
> <li><p><em>ARG_MAX</em>: signed value of a single element with the maximum signed value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MAX_ABS</em>: absolute value of a single element with the maximum absolute value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MAX_INDICATOR</em>: 1 in place of single element with maximum signed value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MAX_ABS_INDICATOR</em>: 1 in place of single element with maximum absolute value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>MAX_VAL</em>: signed value of the element with the maximum signed value,
> or all elements with the maximum value if there are ties.</p></li>
> <li><p><em>MAX_ABS_VAL</em>: absolute value of the element with the maximum absolute value,
> or all elements with the maximum value if there are ties.</p></li>
> <li><p><em>MAX_INDICATOR</em>: 1 in place of the element with the maximum signed value,
> or all elements with the maximum value if there are ties.</p></li>
> <li><p><em>MAX_ABS_INDICATOR</em>: 1 in place of the element(s) with the maximum absolute value,
> or all elements with the maximum value if there are ties.</p></li>
> <li><p><em>ARG_MIN</em>: signed value of a single element with the minium signed value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MIN_ABS</em>: absolute value of a single element with the minium absolute value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MIN_INDICATOR</em>: 1 in place of single element with minimum signed value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>MIN_VAL</em>: signed value of the element with the minimum signed value,
> or all elements with the minimum value if there are ties.</p></li>
> <li><p><em>MIN_ABS_VAL</em>: absolute value of element with the minimum absolute value,
> or all elements with the minimum value if there are ties.</p></li>
> <li><p><em>MIN_INDICATOR</em>: 1 in place of the element with the minimum signed value,
> or all elements with the minimum value if there are ties.</p></li>
> <li><p><em>MIN_ABS_INDICATOR</em>: 1 in place of the element with the minimum absolute value,
> or all elements with the minimum value if there are ties.</p></li>
> <li><p><em>PROB</em>: value of probabilistically chosen element based on probabilities passed in second item of variable;
> if 
...

See CI logs for the full diff.

Copy link

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

diff -r docs-base/EMComposition.html docs-head/EMComposition.html
395,399c395,400
< here there can be one or more keys and any number of values;  if all fields are keys, this implements a full
< form of content-addressable memory. If <strong>learn_field_weight</strong> is True (and <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is either True or a list), then the field_weights can be modified
< during training (this functions similarly to the attention head of a Transformer model, although at present the
< field can only be scalar values rather than vecdtors); if <strong>learn_field_weight</strong> is False, then the field_weights are
< fixed. The following options can be used to specify <strong>field_weights</strong>:</p>
---
> here there can be one or more keys and any number of values;  if all fields are keys, this implements a full form of
> content-addressable memory. If <strong>learn_field_weight</strong> is True (and <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a>
> is either True or a list with True for at least one entry), then the field_weights can be modified during training
> (this functions similarly to the attention head of a Transformer model, although at present the field can only be
> scalar values rather than vecdtors); if <strong>learn_field_weight</strong> is False, then the field_weights are fixed.
> The following options can be used to specify <strong>field_weights</strong>:</p>
494,495c495,496
< <li><p><em>WEIGHTED</em>: softmax-weighted average of entries, based on their dot products with the key(s); this is the default;</p></li>
< <li><p><em>ARG_MAX</em>: entry with the largest dot product.</p></li>
---
> <li><p><em>WEIGHTED_AVG</em> (default): softmax-weighted average of entries, based on their dot products with the key(s).</p></li>
> <li><p><em>ARG_MAX</em>: entry with the largest dot product (one with lowest index in <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.memory" title="psyneulink.library.compositions.emcomposition.EMComposition.memory"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">memory</span></code></a>)               if there are identical ones).</p></li>
502,503c503,505
< these options and <strong>enable_learning</strong> set to True will generate a warning, and calling the EMComposition’s
< <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method will generate an error; it must be changed to <em>WEIGHTED</em> to execute learning.</p>
---
> these options and <strong>enable_learning</strong> set to True (or a list with any True entries) will generate a warning, and
> calling the EMComposition’s <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method will generate an error; it must be changed to
> <em>WEIGHTED_AVG</em> to execute learning.</p>
506,507c508,510
< <p>The <em>WEIGHTED</em> option is passed as <em>ALL</em> to the <strong>output</strong> argument of the <a class="reference internal" href="TransferFunctions.html#psyneulink.core.components.functions.transferfunctions.SoftMax" title="psyneulink.core.components.functions.transferfunctions.SoftMax"><code class="xref any py py-class docutils literal notranslate"><span class="pre">SoftMax</span></code></a> Function, <em>ARG_MAX</em> is
< passed as <em>MAX_INDICATOR</em>; <em>PROBALISTIC</em> is passed as <em>PROB_INDICATOR</em>; and <em>MAX_VAL</em> is not currently supported.</p>
---
> <p>The <em>WEIGHTED_AVG</em> option is passed as <em>ALL</em> to the <strong>output</strong> argument of the <a class="reference internal" href="TransferFunctions.html#psyneulink.core.components.functions.transferfunctions.SoftMax" title="psyneulink.core.components.functions.transferfunctions.SoftMax"><code class="xref any py py-class docutils literal notranslate"><span class="pre">SoftMax</span></code></a> Function, <em>ARG_MAX</em> is
> passed as <em>ARG_MAX_INDICATOR</em>; and <em>PROBALISTIC</em> is passed as <em>PROB_INDICATOR</em>; the other SoftMax options are
> not currently supported.</p>
656,657c659,660
< <p>If <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> is called, <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is True or a list with at
< least one True entry, then errors will be computed for each of the <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">retrieved_nodes</span></code></a>
---
> <p>If <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> is called, <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is True or a list with
> any True entries, then errors will be computed for each of the <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">retrieved_nodes</span></code></a>
858c861
< <li><p><strong>softmax_choice</strong> (<em>WEIGHTED</em><em>, </em><em>ARG_MAX</em><em>, </em><em>PROBABILISTIC : default WEIGHTED</em>) – specifies how the softmax over dot products of keys and memories is used for retrieval;
---
> <li><p><strong>softmax_choice</strong> (<em>WEIGHTED_AVG</em><em>, </em><em>ARG_MAX</em><em>, </em><em>PROBABILISTIC : default WEIGHTED_AVG</em>) – specifies how the softmax over dot products of keys and memories is used for retrieval;
1015c1018
< <dd class="field-odd"><p>WEIGHTED, ARG_MAX or PROBABILISTIC</p>
---
> <dd class="field-odd"><p>WEIGHTED_AVG, ARG_MAX or PROBABILISTIC</p>
1064,1065c1067,1068
< requires <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> to be True for the corresponding field;
< see <a class="reference internal" href="#emcomposition-learning"><span class="std std-ref">Learning</span></a> for additional details.</p>
---
> requires <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> to be True or a list with at least one True
> entry for the corresponding field; see <a class="reference internal" href="#emcomposition-learning"><span class="std std-ref">Learning</span></a> for additional details.</p>
1561,1566c1564
< <dd><p>Override to handle synch and retain args
< Note: defaults for synch and retain args are set to NotImplemented, so that the user can specify None if</p>
< <blockquote>
< <div><p>they want to locally override the default values for the AutodiffComposition (see docstrings for run()
< and _parse_synch_and_retain_args() for additonal details).</p>
< </div></blockquote>
---
> <dd><p>Override to check for inappropriate use of ARG_MAX or PROBABILISTIC options for retrieval with learning</p>
diff -r docs-base/MemoryFunctions.html docs-head/MemoryFunctions.html
438c438
< <li><p><strong>selection_function</strong> (<a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot"><em>OneHot</em></a><em> or </em><em>function : default OneHot</em><em>(</em><em>mode=MIN_VAL</em><em>)</em>) – specifies the function used during retrieval to evaluate the distances returned by <a class="reference internal" href="#psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function" title="psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">distance_function</span></code></a> and select the item to return.</p></li>
---
> <li><p><strong>selection_function</strong> (<a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot"><em>OneHot</em></a><em> or </em><em>function : default OneHot</em><em>(</em><em>mode=ARG_MIN_VAL</em><em>)</em>) – specifies the function used during retrieval to evaluate the distances returned by <a class="reference internal" href="#psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function" title="psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">distance_function</span></code></a> and select the item to return.</p></li>
575c575
< <dd class="field-odd"><p><a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot">OneHot</a> or function : default OneHot(mode=MIN_VAL)</p>
---
> <dd class="field-odd"><p><a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot">OneHot</a> or function : default OneHot(mode=ARG_MIN_VAL)</p>
diff -r docs-base/ModulatoryProjection.html docs-head/ModulatoryProjection.html
272c272
< <a class="reference internal" href="Port.html"><span class="doc">Port</span></a> are listed in the Port’s <a class="reference internal" href="ParameterPort.html#psyneulink.core.components.ports.parameterport.ParameterPort.mod_afferents" title="psyneulink.core.components.ports.parameterport.ParameterPort.mod_afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mod_afferents</span></code></a> attribute.</p>
---
> <a class="reference internal" href="Port.html"><span class="doc">Port</span></a> are listed in the Port’s <a class="reference internal" href="Mechanism.html#id7" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.mod_afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mod_afferents</span></code></a> attribute.</p>
diff -r docs-base/Port.html docs-head/Port.html
616c616
< <code class="xref any docutils literal notranslate"><span class="pre">PathWayProjections</span></code> (listed in its <a class="reference internal" href="#psyneulink.core.components.ports.port.Port_Base.path_afferents" title="psyneulink.core.components.ports.port.Port_Base.path_afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">path_afferents</span></code></a> attribute) as the variable for its
---
> <code class="xref any docutils literal notranslate"><span class="pre">PathWayProjections</span></code> (listed in its <a class="reference internal" href="Mechanism.html#id6" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.path_afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">path_afferents</span></code></a> attribute) as the variable for its
diff -r docs-base/SelectionFunctions.html docs-head/SelectionFunctions.html
219,220c219,220
< with all of its values zeroed except one identified in first item <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.variable" title="psyneulink.core.components.functions.selectionfunctions.OneHot.variable"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">variable</span></code></a> as specified by
< <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.mode" title="psyneulink.core.components.functions.selectionfunctions.OneHot.mode"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mode</span></code></a>:</p>
---
> with all of its values zeroed except one, unless there are ties, which are handled according to the choice of
> <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.mode" title="psyneulink.core.components.functions.selectionfunctions.OneHot.mode"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mode</span></code></a>, as follows:</p>
223,232c223,256
< <li><p><em>MAX_VAL</em>: signed value of the element with the maximum signed value;</p></li>
< <li><p><em>MAX_ABS_VAL</em>: absolute value of the element with the maximum absolute value;</p></li>
< <li><p><em>MAX_INDICATOR</em>: 1 in place of the element with the maximum signed value;</p></li>
< <li><p><em>MAX_ABS_INDICATOR</em>: 1 in place of the element with the maximum absolute value;</p></li>
< <li><p><em>MIN_VAL</em>: signed value of the element with the minimum signed value;</p></li>
< <li><p><em>MIN_ABS_VAL</em>: absolute value of element with the minimum absolute value;</p></li>
< <li><p><em>MIN_INDICATOR</em>: 1 in place of the element with the minimum signed value;</p></li>
< <li><p><em>MIN_ABS_INDICATOR</em>: 1 in place of the element with the minimum absolute value;</p></li>
< <li><p><em>PROB</em>: value of probabilistically chosen element based on probabilities passed in second item of variable;</p></li>
< <li><p><em>PROB_INDICATOR</em>: same as <em>PROB</em> but chosen item is assigned a value of 1.</p></li>
---
> <li><p><em>ARG_MAX</em>: signed value of a single element with the maximum signed value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MAX_ABS</em>: absolute value of a single element with the maximum absolute value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MAX_INDICATOR</em>: 1 in place of single element with maximum signed value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MAX_ABS_INDICATOR</em>: 1 in place of single element with maximum absolute value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>MAX_VAL</em>: signed v
...

See CI logs for the full diff.

• emcomposition.py
  - field_inputs_nodes -> input_nodes_by_fields
  - refactor naming of retrieval nodes to
    use input_nodes_by_fields
PASSES ALL TESTS
• emcomposition.py
  - revise naming of retrieval nodes to use name_without_suffix for reference
Copy link

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

diff -r docs-base/EMComposition.html docs-head/EMComposition.html
395,399c395,400
< here there can be one or more keys and any number of values;  if all fields are keys, this implements a full
< form of content-addressable memory. If <strong>learn_field_weight</strong> is True (and <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is either True or a list), then the field_weights can be modified
< during training (this functions similarly to the attention head of a Transformer model, although at present the
< field can only be scalar values rather than vecdtors); if <strong>learn_field_weight</strong> is False, then the field_weights are
< fixed. The following options can be used to specify <strong>field_weights</strong>:</p>
---
> here there can be one or more keys and any number of values;  if all fields are keys, this implements a full form of
> content-addressable memory. If <strong>learn_field_weight</strong> is True (and <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a>
> is either True or a list with True for at least one entry), then the field_weights can be modified during training
> (this functions similarly to the attention head of a Transformer model, although at present the field can only be
> scalar values rather than vecdtors); if <strong>learn_field_weight</strong> is False, then the field_weights are fixed.
> The following options can be used to specify <strong>field_weights</strong>:</p>
494,495c495,496
< <li><p><em>WEIGHTED</em>: softmax-weighted average of entries, based on their dot products with the key(s); this is the default;</p></li>
< <li><p><em>ARG_MAX</em>: entry with the largest dot product.</p></li>
---
> <li><p><em>WEIGHTED_AVG</em> (default): softmax-weighted average of entries, based on their dot products with the key(s).</p></li>
> <li><p><em>ARG_MAX</em>: entry with the largest dot product (one with lowest index in <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.memory" title="psyneulink.library.compositions.emcomposition.EMComposition.memory"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">memory</span></code></a>)               if there are identical ones).</p></li>
502,503c503,505
< these options and <strong>enable_learning</strong> set to True will generate a warning, and calling the EMComposition’s
< <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method will generate an error; it must be changed to <em>WEIGHTED</em> to execute learning.</p>
---
> these options and <strong>enable_learning</strong> set to True (or a list with any True entries) will generate a warning, and
> calling the EMComposition’s <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method will generate an error; it must be changed to
> <em>WEIGHTED_AVG</em> to execute learning.</p>
506,507c508,510
< <p>The <em>WEIGHTED</em> option is passed as <em>ALL</em> to the <strong>output</strong> argument of the <a class="reference internal" href="TransferFunctions.html#psyneulink.core.components.functions.transferfunctions.SoftMax" title="psyneulink.core.components.functions.transferfunctions.SoftMax"><code class="xref any py py-class docutils literal notranslate"><span class="pre">SoftMax</span></code></a> Function, <em>ARG_MAX</em> is
< passed as <em>MAX_INDICATOR</em>; <em>PROBALISTIC</em> is passed as <em>PROB_INDICATOR</em>; and <em>MAX_VAL</em> is not currently supported.</p>
---
> <p>The <em>WEIGHTED_AVG</em> option is passed as <em>ALL</em> to the <strong>output</strong> argument of the <a class="reference internal" href="TransferFunctions.html#psyneulink.core.components.functions.transferfunctions.SoftMax" title="psyneulink.core.components.functions.transferfunctions.SoftMax"><code class="xref any py py-class docutils literal notranslate"><span class="pre">SoftMax</span></code></a> Function, <em>ARG_MAX</em> is
> passed as <em>ARG_MAX_INDICATOR</em>; and <em>PROBALISTIC</em> is passed as <em>PROB_INDICATOR</em>; the other SoftMax options are
> not currently supported.</p>
656,657c659,660
< <p>If <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> is called, <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is True or a list with at
< least one True entry, then errors will be computed for each of the <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">retrieved_nodes</span></code></a>
---
> <p>If <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> is called, <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is True or a list with
> any True entries, then errors will be computed for each of the <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">retrieved_nodes</span></code></a>
858c861
< <li><p><strong>softmax_choice</strong> (<em>WEIGHTED</em><em>, </em><em>ARG_MAX</em><em>, </em><em>PROBABILISTIC : default WEIGHTED</em>) – specifies how the softmax over dot products of keys and memories is used for retrieval;
---
> <li><p><strong>softmax_choice</strong> (<em>WEIGHTED_AVG</em><em>, </em><em>ARG_MAX</em><em>, </em><em>PROBABILISTIC : default WEIGHTED_AVG</em>) – specifies how the softmax over dot products of keys and memories is used for retrieval;
1015c1018
< <dd class="field-odd"><p>WEIGHTED, ARG_MAX or PROBABILISTIC</p>
---
> <dd class="field-odd"><p>WEIGHTED_AVG, ARG_MAX or PROBABILISTIC</p>
1064,1065c1067,1068
< requires <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> to be True for the corresponding field;
< see <a class="reference internal" href="#emcomposition-learning"><span class="std std-ref">Learning</span></a> for additional details.</p>
---
> requires <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> to be True or a list with at least one True
> entry for the corresponding field; see <a class="reference internal" href="#emcomposition-learning"><span class="std std-ref">Learning</span></a> for additional details.</p>
1132,1133c1135,1136
< <dt class="sig sig-object py" id="psyneulink.library.compositions.emcomposition.EMComposition.field_input_nodes">
< <span class="sig-name descname"><span class="pre">field_input_nodes</span></span><a class="headerlink" href="#psyneulink.library.compositions.emcomposition.EMComposition.field_input_nodes" title="Permalink to this definition">¶</a></dt>
---
> <dt class="sig sig-object py" id="psyneulink.library.compositions.emcomposition.EMComposition.input_nodes_by_fields">
> <span class="sig-name descname"><span class="pre">input_nodes_by_fields</span></span><a class="headerlink" href="#psyneulink.library.compositions.emcomposition.EMComposition.input_nodes_by_fields" title="Permalink to this definition">¶</a></dt>
1263,1264c1266,1267
< * [RETRIEVED]*, and are in the same order as  <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.field_input_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.field_input_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">field_input_nodes</span></code></a> to which
< to which they correspond.</p>
---
> * [RETRIEVED]*, and are in the same order as  <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.input_nodes_by_fields" title="psyneulink.library.compositions.emcomposition.EMComposition.input_nodes_by_fields"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">input_nodes_by_fields</span></code></a>
> to which to which they correspond.</p>
1561,1566c1564
< <dd><p>Override to handle synch and retain args
< Note: defaults for synch and retain args are set to NotImplemented, so that the user can specify None if</p>
< <blockquote>
< <div><p>they want to locally override the default values for the AutodiffComposition (see docstrings for run()
< and _parse_synch_and_retain_args() for additonal details).</p>
< </div></blockquote>
---
> <dd><p>Override to check for inappropriate use of ARG_MAX or PROBABILISTIC options for retrieval with learning</p>
diff -r docs-base/MemoryFunctions.html docs-head/MemoryFunctions.html
438c438
< <li><p><strong>selection_function</strong> (<a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot"><em>OneHot</em></a><em> or </em><em>function : default OneHot</em><em>(</em><em>mode=MIN_VAL</em><em>)</em>) – specifies the function used during retrieval to evaluate the distances returned by <a class="reference internal" href="#psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function" title="psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">distance_function</span></code></a> and select the item to return.</p></li>
---
> <li><p><strong>selection_function</strong> (<a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot"><em>OneHot</em></a><em> or </em><em>function : default OneHot</em><em>(</em><em>mode=ARG_MIN_VAL</em><em>)</em>) – specifies the function used during retrieval to evaluate the distances returned by <a class="reference internal" href="#psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function" title="psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">distance_function</span></code></a> and select the item to return.</p></li>
575c575
< <dd class="field-odd"><p><a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot">OneHot</a> or function : default OneHot(mode=MIN_VAL)</p>
---
> <dd class="field-odd"><p><a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot">OneHot</a> or function : default OneHot(mode=ARG_MIN_VAL)</p>
diff -r docs-base/ModulatoryProjection.html docs-head/ModulatoryProjection.html
272c272
< <a class="reference internal" href="Port.html"><span class="doc">Port</span></a> are listed in the Port’s <a class="reference internal" href="Mechanism.html#id7" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.mod_afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mod_afferents</span></code></a> attribute.</p>
---
> <a class="reference internal" href="Port.html"><span class="doc">Port</span></a> are listed in the Port’s <a class="reference internal" href="ParameterPort.html#psyneulink.core.components.ports.parameterport.ParameterPort.mod_afferents" title="psyneulink.core.components.ports.parameterport.ParameterPort.mod_afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mod_afferents</span></code></a> attribute.</p>
diff -r docs-base/Port.html docs-head/Port.html
616c616
< <code class="xref any docutils literal notranslate"><span class="pre">PathWayProjections</span></code> (listed in its <a class="reference internal" href="Mechanism.html#id6" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.path_afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">path_afferents</span></code></a> attribute) as the variable for its
---
> <code class="xref any docutils literal notranslate"><span class="pre">PathWayProjections</span></code> (listed in its <a class="reference internal" href="#psyneulink.core.components.ports.port.Port_Base.path_afferents" title="psyneulink.core.components.ports.port.Port_Base.path_afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">path_afferents</span></code></a> attribute) as the variable for its
diff -r docs-base/SelectionFunctions.html docs-head/SelectionFunctions.html
219,220c219,220
< with all of its values zeroed except one identified in first item <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.variable" title="psyneulink.core.components.functions.selectionfunctions.OneHot.variable"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">variable</span></code></a> as specified by
< <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.mode" title="psyneulink.core.components.functions.selectionfunctions.OneHot.mode"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mode</span></code></a>:</p>
---
> with all of its values zeroed except one, unless there are ties, which are handled according to the choice of
> <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.mode" title="psyneulink.core.components.functions.selectionfunctions.OneHot.mode"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mode</span></code></a>, as follows:</p>
223,232c223,256
< <li><p><em>MAX_VAL</em>: signed value of the element with the maximum signed value;</p></li>
< 
...

See CI logs for the full diff.

Copy link

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

diff -r docs-base/EMComposition.html docs-head/EMComposition.html
395,399c395,400
< here there can be one or more keys and any number of values;  if all fields are keys, this implements a full
< form of content-addressable memory. If <strong>learn_field_weight</strong> is True (and <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is either True or a list), then the field_weights can be modified
< during training (this functions similarly to the attention head of a Transformer model, although at present the
< field can only be scalar values rather than vecdtors); if <strong>learn_field_weight</strong> is False, then the field_weights are
< fixed. The following options can be used to specify <strong>field_weights</strong>:</p>
---
> here there can be one or more keys and any number of values;  if all fields are keys, this implements a full form of
> content-addressable memory. If <strong>learn_field_weight</strong> is True (and <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a>
> is either True or a list with True for at least one entry), then the field_weights can be modified during training
> (this functions similarly to the attention head of a Transformer model, although at present the field can only be
> scalar values rather than vecdtors); if <strong>learn_field_weight</strong> is False, then the field_weights are fixed.
> The following options can be used to specify <strong>field_weights</strong>:</p>
494,495c495,496
< <li><p><em>WEIGHTED</em>: softmax-weighted average of entries, based on their dot products with the key(s); this is the default;</p></li>
< <li><p><em>ARG_MAX</em>: entry with the largest dot product.</p></li>
---
> <li><p><em>WEIGHTED_AVG</em> (default): softmax-weighted average of entries, based on their dot products with the key(s).</p></li>
> <li><p><em>ARG_MAX</em>: entry with the largest dot product (one with lowest index in <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.memory" title="psyneulink.library.compositions.emcomposition.EMComposition.memory"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">memory</span></code></a>)               if there are identical ones).</p></li>
502,503c503,505
< these options and <strong>enable_learning</strong> set to True will generate a warning, and calling the EMComposition’s
< <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method will generate an error; it must be changed to <em>WEIGHTED</em> to execute learning.</p>
---
> these options and <strong>enable_learning</strong> set to True (or a list with any True entries) will generate a warning, and
> calling the EMComposition’s <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method will generate an error; it must be changed to
> <em>WEIGHTED_AVG</em> to execute learning.</p>
506,507c508,510
< <p>The <em>WEIGHTED</em> option is passed as <em>ALL</em> to the <strong>output</strong> argument of the <a class="reference internal" href="TransferFunctions.html#psyneulink.core.components.functions.transferfunctions.SoftMax" title="psyneulink.core.components.functions.transferfunctions.SoftMax"><code class="xref any py py-class docutils literal notranslate"><span class="pre">SoftMax</span></code></a> Function, <em>ARG_MAX</em> is
< passed as <em>MAX_INDICATOR</em>; <em>PROBALISTIC</em> is passed as <em>PROB_INDICATOR</em>; and <em>MAX_VAL</em> is not currently supported.</p>
---
> <p>The <em>WEIGHTED_AVG</em> option is passed as <em>ALL</em> to the <strong>output</strong> argument of the <a class="reference internal" href="TransferFunctions.html#psyneulink.core.components.functions.transferfunctions.SoftMax" title="psyneulink.core.components.functions.transferfunctions.SoftMax"><code class="xref any py py-class docutils literal notranslate"><span class="pre">SoftMax</span></code></a> Function, <em>ARG_MAX</em> is
> passed as <em>ARG_MAX_INDICATOR</em>; and <em>PROBALISTIC</em> is passed as <em>PROB_INDICATOR</em>; the other SoftMax options are
> not currently supported.</p>
656,657c659,660
< <p>If <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> is called, <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is True or a list with at
< least one True entry, then errors will be computed for each of the <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">retrieved_nodes</span></code></a>
---
> <p>If <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> is called, <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is True or a list with
> any True entries, then errors will be computed for each of the <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">retrieved_nodes</span></code></a>
858c861
< <li><p><strong>softmax_choice</strong> (<em>WEIGHTED</em><em>, </em><em>ARG_MAX</em><em>, </em><em>PROBABILISTIC : default WEIGHTED</em>) – specifies how the softmax over dot products of keys and memories is used for retrieval;
---
> <li><p><strong>softmax_choice</strong> (<em>WEIGHTED_AVG</em><em>, </em><em>ARG_MAX</em><em>, </em><em>PROBABILISTIC : default WEIGHTED_AVG</em>) – specifies how the softmax over dot products of keys and memories is used for retrieval;
1015c1018
< <dd class="field-odd"><p>WEIGHTED, ARG_MAX or PROBABILISTIC</p>
---
> <dd class="field-odd"><p>WEIGHTED_AVG, ARG_MAX or PROBABILISTIC</p>
1064,1065c1067,1068
< requires <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> to be True for the corresponding field;
< see <a class="reference internal" href="#emcomposition-learning"><span class="std std-ref">Learning</span></a> for additional details.</p>
---
> requires <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> to be True or a list with at least one True
> entry for the corresponding field; see <a class="reference internal" href="#emcomposition-learning"><span class="std std-ref">Learning</span></a> for additional details.</p>
1132,1133c1135,1136
< <dt class="sig sig-object py" id="psyneulink.library.compositions.emcomposition.EMComposition.field_input_nodes">
< <span class="sig-name descname"><span class="pre">field_input_nodes</span></span><a class="headerlink" href="#psyneulink.library.compositions.emcomposition.EMComposition.field_input_nodes" title="Permalink to this definition">¶</a></dt>
---
> <dt class="sig sig-object py" id="psyneulink.library.compositions.emcomposition.EMComposition.input_nodes_by_fields">
> <span class="sig-name descname"><span class="pre">input_nodes_by_fields</span></span><a class="headerlink" href="#psyneulink.library.compositions.emcomposition.EMComposition.input_nodes_by_fields" title="Permalink to this definition">¶</a></dt>
1263,1264c1266,1267
< * [RETRIEVED]*, and are in the same order as  <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.field_input_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.field_input_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">field_input_nodes</span></code></a> to which
< to which they correspond.</p>
---
> * [RETRIEVED]*, and are in the same order as  <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.input_nodes_by_fields" title="psyneulink.library.compositions.emcomposition.EMComposition.input_nodes_by_fields"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">input_nodes_by_fields</span></code></a>
> to which to which they correspond.</p>
1561,1566c1564
< <dd><p>Override to handle synch and retain args
< Note: defaults for synch and retain args are set to NotImplemented, so that the user can specify None if</p>
< <blockquote>
< <div><p>they want to locally override the default values for the AutodiffComposition (see docstrings for run()
< and _parse_synch_and_retain_args() for additonal details).</p>
< </div></blockquote>
---
> <dd><p>Override to check for inappropriate use of ARG_MAX or PROBABILISTIC options for retrieval with learning</p>
diff -r docs-base/MemoryFunctions.html docs-head/MemoryFunctions.html
438c438
< <li><p><strong>selection_function</strong> (<a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot"><em>OneHot</em></a><em> or </em><em>function : default OneHot</em><em>(</em><em>mode=MIN_VAL</em><em>)</em>) – specifies the function used during retrieval to evaluate the distances returned by <a class="reference internal" href="#psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function" title="psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">distance_function</span></code></a> and select the item to return.</p></li>
---
> <li><p><strong>selection_function</strong> (<a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot"><em>OneHot</em></a><em> or </em><em>function : default OneHot</em><em>(</em><em>mode=ARG_MIN_VAL</em><em>)</em>) – specifies the function used during retrieval to evaluate the distances returned by <a class="reference internal" href="#psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function" title="psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">distance_function</span></code></a> and select the item to return.</p></li>
575c575
< <dd class="field-odd"><p><a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot">OneHot</a> or function : default OneHot(mode=MIN_VAL)</p>
---
> <dd class="field-odd"><p><a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot">OneHot</a> or function : default OneHot(mode=ARG_MIN_VAL)</p>
diff -r docs-base/ModulatoryProjection.html docs-head/ModulatoryProjection.html
272c272
< <a class="reference internal" href="Port.html"><span class="doc">Port</span></a> are listed in the Port’s <a class="reference internal" href="Mechanism.html#id7" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.mod_afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mod_afferents</span></code></a> attribute.</p>
---
> <a class="reference internal" href="Port.html"><span class="doc">Port</span></a> are listed in the Port’s <a class="reference internal" href="ParameterPort.html#psyneulink.core.components.ports.parameterport.ParameterPort.mod_afferents" title="psyneulink.core.components.ports.parameterport.ParameterPort.mod_afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mod_afferents</span></code></a> attribute.</p>
diff -r docs-base/Port.html docs-head/Port.html
616c616
< <code class="xref any docutils literal notranslate"><span class="pre">PathWayProjections</span></code> (listed in its <a class="reference internal" href="Mechanism.html#id6" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.path_afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">path_afferents</span></code></a> attribute) as the variable for its
---
> <code class="xref any docutils literal notranslate"><span class="pre">PathWayProjections</span></code> (listed in its <a class="reference internal" href="#psyneulink.core.components.ports.port.Port_Base.path_afferents" title="psyneulink.core.components.ports.port.Port_Base.path_afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">path_afferents</span></code></a> attribute) as the variable for its
diff -r docs-base/SelectionFunctions.html docs-head/SelectionFunctions.html
219,220c219,220
< with all of its values zeroed except one identified in first item <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.variable" title="psyneulink.core.components.functions.selectionfunctions.OneHot.variable"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">variable</span></code></a> as specified by
< <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.mode" title="psyneulink.core.components.functions.selectionfunctions.OneHot.mode"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mode</span></code></a>:</p>
---
> with all of its values zeroed except one, unless there are ties, which are handled according to the choice of
> <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.mode" title="psyneulink.core.components.functions.selectionfunctions.OneHot.mode"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mode</span></code></a>, as follows:</p>
223,232c223,256
< <li><p><em>MAX_VAL</em>: signed value of the element with the maximum signed value;</p></li>
< 
...

See CI logs for the full diff.

Copy link

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

diff -r docs-base/EMComposition.html docs-head/EMComposition.html
395,399c395,400
< here there can be one or more keys and any number of values;  if all fields are keys, this implements a full
< form of content-addressable memory. If <strong>learn_field_weight</strong> is True (and <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is either True or a list), then the field_weights can be modified
< during training (this functions similarly to the attention head of a Transformer model, although at present the
< field can only be scalar values rather than vecdtors); if <strong>learn_field_weight</strong> is False, then the field_weights are
< fixed. The following options can be used to specify <strong>field_weights</strong>:</p>
---
> here there can be one or more keys and any number of values;  if all fields are keys, this implements a full form of
> content-addressable memory. If <strong>learn_field_weight</strong> is True (and <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a>
> is either True or a list with True for at least one entry), then the field_weights can be modified during training
> (this functions similarly to the attention head of a Transformer model, although at present the field can only be
> scalar values rather than vecdtors); if <strong>learn_field_weight</strong> is False, then the field_weights are fixed.
> The following options can be used to specify <strong>field_weights</strong>:</p>
494,495c495,496
< <li><p><em>WEIGHTED</em>: softmax-weighted average of entries, based on their dot products with the key(s); this is the default;</p></li>
< <li><p><em>ARG_MAX</em>: entry with the largest dot product.</p></li>
---
> <li><p><em>WEIGHTED_AVG</em> (default): softmax-weighted average of entries, based on their dot products with the key(s).</p></li>
> <li><p><em>ARG_MAX</em>: entry with the largest dot product (one with lowest index in <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.memory" title="psyneulink.library.compositions.emcomposition.EMComposition.memory"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">memory</span></code></a>)               if there are identical ones).</p></li>
502,503c503,505
< these options and <strong>enable_learning</strong> set to True will generate a warning, and calling the EMComposition’s
< <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method will generate an error; it must be changed to <em>WEIGHTED</em> to execute learning.</p>
---
> these options and <strong>enable_learning</strong> set to True (or a list with any True entries) will generate a warning, and
> calling the EMComposition’s <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method will generate an error; it must be changed to
> <em>WEIGHTED_AVG</em> to execute learning.</p>
506,507c508,510
< <p>The <em>WEIGHTED</em> option is passed as <em>ALL</em> to the <strong>output</strong> argument of the <a class="reference internal" href="TransferFunctions.html#psyneulink.core.components.functions.transferfunctions.SoftMax" title="psyneulink.core.components.functions.transferfunctions.SoftMax"><code class="xref any py py-class docutils literal notranslate"><span class="pre">SoftMax</span></code></a> Function, <em>ARG_MAX</em> is
< passed as <em>MAX_INDICATOR</em>; <em>PROBALISTIC</em> is passed as <em>PROB_INDICATOR</em>; and <em>MAX_VAL</em> is not currently supported.</p>
---
> <p>The <em>WEIGHTED_AVG</em> option is passed as <em>ALL</em> to the <strong>output</strong> argument of the <a class="reference internal" href="TransferFunctions.html#psyneulink.core.components.functions.transferfunctions.SoftMax" title="psyneulink.core.components.functions.transferfunctions.SoftMax"><code class="xref any py py-class docutils literal notranslate"><span class="pre">SoftMax</span></code></a> Function, <em>ARG_MAX</em> is
> passed as <em>ARG_MAX_INDICATOR</em>; and <em>PROBALISTIC</em> is passed as <em>PROB_INDICATOR</em>; the other SoftMax options are
> not currently supported.</p>
656,657c659,660
< <p>If <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> is called, <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is True or a list with at
< least one True entry, then errors will be computed for each of the <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">retrieved_nodes</span></code></a>
---
> <p>If <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learn" title="psyneulink.core.compositions.composition.Composition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> is called, <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> is True or a list with
> any True entries, then errors will be computed for each of the <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.retrieved_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">retrieved_nodes</span></code></a>
858c861
< <li><p><strong>softmax_choice</strong> (<em>WEIGHTED</em><em>, </em><em>ARG_MAX</em><em>, </em><em>PROBABILISTIC : default WEIGHTED</em>) – specifies how the softmax over dot products of keys and memories is used for retrieval;
---
> <li><p><strong>softmax_choice</strong> (<em>WEIGHTED_AVG</em><em>, </em><em>ARG_MAX</em><em>, </em><em>PROBABILISTIC : default WEIGHTED_AVG</em>) – specifies how the softmax over dot products of keys and memories is used for retrieval;
1015c1018
< <dd class="field-odd"><p>WEIGHTED, ARG_MAX or PROBABILISTIC</p>
---
> <dd class="field-odd"><p>WEIGHTED_AVG, ARG_MAX or PROBABILISTIC</p>
1064,1065c1067,1068
< requires <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> to be True for the corresponding field;
< see <a class="reference internal" href="#emcomposition-learning"><span class="std std-ref">Learning</span></a> for additional details.</p>
---
> requires <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.enable_learning" title="psyneulink.library.compositions.emcomposition.EMComposition.enable_learning"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">enable_learning</span></code></a> to be True or a list with at least one True
> entry for the corresponding field; see <a class="reference internal" href="#emcomposition-learning"><span class="std std-ref">Learning</span></a> for additional details.</p>
1132,1133c1135,1136
< <dt class="sig sig-object py" id="psyneulink.library.compositions.emcomposition.EMComposition.field_input_nodes">
< <span class="sig-name descname"><span class="pre">field_input_nodes</span></span><a class="headerlink" href="#psyneulink.library.compositions.emcomposition.EMComposition.field_input_nodes" title="Permalink to this definition">¶</a></dt>
---
> <dt class="sig sig-object py" id="psyneulink.library.compositions.emcomposition.EMComposition.input_nodes_by_fields">
> <span class="sig-name descname"><span class="pre">input_nodes_by_fields</span></span><a class="headerlink" href="#psyneulink.library.compositions.emcomposition.EMComposition.input_nodes_by_fields" title="Permalink to this definition">¶</a></dt>
1263,1264c1266,1267
< * [RETRIEVED]*, and are in the same order as  <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.field_input_nodes" title="psyneulink.library.compositions.emcomposition.EMComposition.field_input_nodes"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">field_input_nodes</span></code></a> to which
< to which they correspond.</p>
---
> * [RETRIEVED]*, and are in the same order as  <a class="reference internal" href="#psyneulink.library.compositions.emcomposition.EMComposition.input_nodes_by_fields" title="psyneulink.library.compositions.emcomposition.EMComposition.input_nodes_by_fields"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">input_nodes_by_fields</span></code></a>
> to which to which they correspond.</p>
1561,1566c1564
< <dd><p>Override to handle synch and retain args
< Note: defaults for synch and retain args are set to NotImplemented, so that the user can specify None if</p>
< <blockquote>
< <div><p>they want to locally override the default values for the AutodiffComposition (see docstrings for run()
< and _parse_synch_and_retain_args() for additonal details).</p>
< </div></blockquote>
---
> <dd><p>Override to check for inappropriate use of ARG_MAX or PROBABILISTIC options for retrieval with learning</p>
diff -r docs-base/MemoryFunctions.html docs-head/MemoryFunctions.html
438c438
< <li><p><strong>selection_function</strong> (<a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot"><em>OneHot</em></a><em> or </em><em>function : default OneHot</em><em>(</em><em>mode=MIN_VAL</em><em>)</em>) – specifies the function used during retrieval to evaluate the distances returned by <a class="reference internal" href="#psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function" title="psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">distance_function</span></code></a> and select the item to return.</p></li>
---
> <li><p><strong>selection_function</strong> (<a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot"><em>OneHot</em></a><em> or </em><em>function : default OneHot</em><em>(</em><em>mode=ARG_MIN_VAL</em><em>)</em>) – specifies the function used during retrieval to evaluate the distances returned by <a class="reference internal" href="#psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function" title="psyneulink.core.components.functions.stateful.memoryfunctions.DictionaryMemory.distance_function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">distance_function</span></code></a> and select the item to return.</p></li>
575c575
< <dd class="field-odd"><p><a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot">OneHot</a> or function : default OneHot(mode=MIN_VAL)</p>
---
> <dd class="field-odd"><p><a class="reference internal" href="SelectionFunctions.html#psyneulink.core.components.functions.selectionfunctions.OneHot" title="psyneulink.core.components.functions.selectionfunctions.OneHot">OneHot</a> or function : default OneHot(mode=ARG_MIN_VAL)</p>
diff -r docs-base/SelectionFunctions.html docs-head/SelectionFunctions.html
219,220c219,220
< with all of its values zeroed except one identified in first item <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.variable" title="psyneulink.core.components.functions.selectionfunctions.OneHot.variable"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">variable</span></code></a> as specified by
< <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.mode" title="psyneulink.core.components.functions.selectionfunctions.OneHot.mode"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mode</span></code></a>:</p>
---
> with all of its values zeroed except one, unless there are ties, which are handled according to the choice of
> <a class="reference internal" href="#psyneulink.core.components.functions.selectionfunctions.OneHot.mode" title="psyneulink.core.components.functions.selectionfunctions.OneHot.mode"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">mode</span></code></a>, as follows:</p>
223,232c223,256
< <li><p><em>MAX_VAL</em>: signed value of the element with the maximum signed value;</p></li>
< <li><p><em>MAX_ABS_VAL</em>: absolute value of the element with the maximum absolute value;</p></li>
< <li><p><em>MAX_INDICATOR</em>: 1 in place of the element with the maximum signed value;</p></li>
< <li><p><em>MAX_ABS_INDICATOR</em>: 1 in place of the element with the maximum absolute value;</p></li>
< <li><p><em>MIN_VAL</em>: signed value of the element with the minimum signed value;</p></li>
< <li><p><em>MIN_ABS_VAL</em>: absolute value of element with the minimum absolute value;</p></li>
< <li><p><em>MIN_INDICATOR</em>: 1 in place of the element with the minimum signed value;</p></li>
< <li><p><em>MIN_ABS_INDICATOR</em>: 1 in place of the element with the minimum absolute value;</p></li>
< <li><p><em>PROB</em>: value of probabilistically chosen element based on probabilities passed in second item of variable;</p></li>
< <li><p><em>PROB_INDICATOR</em>: same as <em>PROB</em> but chosen item is assigned a value of 1.</p></li>
---
> <li><p><em>ARG_MAX</em>: signed value of a single element with the maximum signed value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MAX_ABS</em>: absolute value of a single element with the maximum absolute value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MAX_INDICATOR</em>: 1 in place of single element with maximum signed value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>ARG_MAX_ABS_INDICATOR</em>: 1 in place of single element with maximum absolute value,
> or the one with lowest index if there are ties.</p></li>
> <li><p><em>MAX_VAL</em>: signed value of the element with the maximum signed value,
> or all elements with the maximum value if there are ties.</p></li>
> <li><p><em>MAX_ABS_VAL</em>: absolute value of the element with the maximum absolute value,
> or all elements wit
...

See CI logs for the full diff.

@jdcpni jdcpni merged commit 24f6823 into devel Oct 25, 2024
71 checks passed
@jdcpni jdcpni deleted the fix/one_hot_max_indicator branch October 25, 2024 18:34
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