Skip to content

Commit

Permalink
• composition.py
Browse files Browse the repository at this point in the history
  mods to docstring

• test_composition.py
  - test_remove_node(): uncomment conditions
  • Loading branch information
jdcpni committed Jan 3, 2025
1 parent bc850c4 commit 44186d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
13 changes: 7 additions & 6 deletions psyneulink/core/compositions/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,13 @@
^^^^^^^^^^^^

`BIAS` `NodeRole` can be used to implement BIAS Nodes, which add a bias (constant value) to the input of another
Node, that can also be modified by `learning <Composition_Learning>`. A bias Node is implemented by adding a
`ProcessingMechanism` to the Composition and requiring it to have the `BIAS` `NodeRole`. The ProcessingMechanims
cannot have any afferent Projections, and should project to the `InputPort` containing the values to be biased. If
the bias is to be learned, the `learnable <MappingProjection.learnable>` attribute of the MappingProjeciton
should be set to True. The value of the bias, and how it is applied to the values being biased are specified as
described below:
Node, that can also be modified by `learning <Composition_Learning>`. A BIAS Node is implemented by adding a
`ProcessingMechanism` to the Composition and requiring it to have the `BIAS` `NodeRole`. This can be done using
any of the methods described `above <Composition_Nodes>` for assigning `NodeRoles <NodeRole>` tp a Node. The
ProcessingMechanism cannot have any afferent Projections, and should project to the `InputPort` of the Node with
the values to be biased. If the bias is to be learned, the `learnable <MappingProjection.learnable>` attribute of
the MappingProjeciton should be set to True. The value of the bias, and how it is applied to the values being biased
are specified as described below:

*Single bias value*. To apply a single scalar bias value to all elements of the array being biased, the
`default_variable <Component_Variable>` of the BIAS Node should be specified as a scalar value, and the `matrix
Expand Down
10 changes: 5 additions & 5 deletions tests/composition/test_composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -8139,11 +8139,11 @@ def test_danglingControlledMech(self):
@pytest.mark.parametrize(
'removed_nodes, expected_dependencies',
[
# (['A'], {'B': set(), 'C': set('B'), 'D': set('C'), 'E': set('C')}),
# (['C'], {'A': set(), 'B': set(), 'D': set(), 'E': set()}),
# (['E'], {'A': set(), 'B': set(), 'C': {'A', 'B'}, 'D': set('C')}),
# (['A', 'B'], {'C': set(), 'D': set('C'), 'E': set('C')}),
# (['D', 'E'], {'A': set(), 'B': set(), 'C': {'A', 'B'}}),
(['A'], {'B': set(), 'C': set('B'), 'D': set('C'), 'E': set('C')}),
(['C'], {'A': set(), 'B': set(), 'D': set(), 'E': set()}),
(['E'], {'A': set(), 'B': set(), 'C': {'A', 'B'}, 'D': set('C')}),
(['A', 'B'], {'C': set(), 'D': set('C'), 'E': set('C')}),
(['D', 'E'], {'A': set(), 'B': set(), 'C': {'A', 'B'}}),
(['A', 'B', 'C', 'D', 'E'], {}),
]
)
Expand Down

0 comments on commit 44186d8

Please sign in to comment.