-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/em composition refactor learning mech #2754
Conversation
- all_entries_identical()
first draft of module that implements episodic / external memory Composition
- add error message for specifcation of default_control_allocation or default_gating_allocation
- add error message for specifcation of default_control_allocation or default_gating_allocation
- add error message for specifcation of default_control_allocation or default_gating_allocation
- constructs but wiring still not right
- first draft; needs to be run
- add memory decay and storage
- storage and retrieval working
- exclude value_input_nodes as NodeRole.OUTPUT
- TODO notes
- suppress warning for no efferent projectsions
- add storage_prob and related parameters - docs in progress
This PR causes the following changes to the html docs (ubuntu-latest-3.7-x64):
See CI logs for the full diff. |
def _validate_field_types(self, field_types): | ||
if not len(field_types) or len(field_types) != len(self.fields): | ||
return f"must be specified with a number of items equal to " \ | ||
f"the number of fields specified {len(self.fields)}" | ||
if not all(item in {1,0} for item in field_types): | ||
return f"must be a list of 1s (for keys) and 0s (for values)." | ||
|
||
def _validate_field_weights(self, field_weights): |
Check notice
Code scanning / CodeQL
Explicit returns mixed with implicit (fall through) returns Note
# Get matrix containing memories for the field from the Projection | ||
field_memory_matrix = field_projection.parameters.matrix.get(context) | ||
|
||
value.append(super(LearningMechanism, self)._execute(variable=entry_to_store, |
Check failure
Code scanning / CodeQL
First argument to super() is not enclosing class Error
field_norms = np.array([np.linalg.norm(field, axis=1) | ||
for field in [row for row in self.parameters.memory.get(context)]]) | ||
if purge_by_field_weights: | ||
field_norms *= self.field_weights |
Check warning
Code scanning / CodeQL
Unreachable code Warning
# if concatenate_keys: | ||
# projections = [self.concatenate_keys_node.input_ports[i].path_afferents[0] for i in range(self.num_keys)] + \ | ||
# [self.retrieved_nodes[i].input_port.path_afferents[0] for i in range(len(self.input_nodes))] | ||
# variable = [self.input_nodes[i].value[0] for i in range(self.num_fields)] | ||
# fields = [self.input_nodes[i] for i in range(self.num_fields)] | ||
# else: | ||
# variable = [self.input_nodes[i].value[0] for i in range(self.num_fields)] | ||
# fields = [self.input_nodes[i] for i in range(self.num_fields)] | ||
# projections = [self.match_nodes[i].input_port.path_afferents[0] for i in range(self.num_keys)] + \ | ||
# [self.retrieved_nodes[i].input_port.path_afferents[0] for i in range(len(self.input_nodes))] |
Check notice
Code scanning / CodeQL
Commented-out code Note
pytest.skip('Compilation not yet support for Composition.import.') | ||
|
||
def temp(context): | ||
memory = context.composition.parameters.memory.get(context) |
Check notice
Code scanning / CodeQL
Unused local variable Note test
if comp_mode != pnl.ExecutionMode.Python: | ||
pytest.skip('Compilation not yet support for Composition.import.') | ||
|
||
def temp(context): |
Check notice
Code scanning / CodeQL
Unused local variable Note test
This PR causes the following changes to the html docs (ubuntu-latest-3.7-x64):
See CI logs for the full diff. |
- _parse_port_specific_specs(): fix bug in which COMBINE was not parsed
- _parse_port_specific_specs(): fix bug in which COMBINE was not parsed when specified in an InputPort specification dict (though still some weirdness) • port.py _parse_port_spec(): add passing of Context.string for caller ID
This PR causes the following changes to the html docs (ubuntu-latest-3.7-x64):
See CI logs for the full diff. |
This PR causes the following changes to the html docs (ubuntu-latest-3.7-x64):
See CI logs for the full diff. |
- passes tests sequentially but not in parallel. Error: > num_fields = len(owning_component.fields) E TypeError: object of type 'NoneType' has no len() ../../psyneulink/library/components/mechanisms/modulatory/learning/EMstoragemechanism.py:211: TypeError
- refactor memory_matrix to use learning_signals • emcomposition.py - refactor to use memory_matrix of storage_node if that is implemented
This PR causes the following changes to the html docs (ubuntu-latest-3.7-x64):
See CI logs for the full diff. |
This PR causes the following changes to the html docs (ubuntu-latest-3.7-x64):
See CI logs for the full diff. |
# def _memory_matrix_getter(owning_component=None, context=None): | ||
# if context.composition: | ||
# return context.composition.parameters.memory._get(context) | ||
# else: | ||
# return None |
Check notice
Code scanning / CodeQL
Commented-out code Note
* origin/devel: tests/ParameterEstimationComposition: Reduce the number of estimates by 40x tests/ParameterEstimationComposition: Provide expected result instead of relying on tolerance requirements: update dill requirement from <0.3.7 to <0.3.8 (PrincetonUniversity#2743) Feat/em composition refactor learning mech (PrincetonUniversity#2754) Fix/input port combine (PrincetonUniversity#2755) requirements: update beartype requirement from <0.15.0 to <0.16.0 (PrincetonUniversity#2744)
• EMstoragemechanism.py - refactor memory_matrix to use learning_signals • emcomposition.py - refactor to use memory_matrix of storage_node if that is implemented Co-authored-by: jdcpni <pniintel55>
* origin/master: tests/ParameterEstimationComposition: Reduce the number of estimates by 40x tests/ParameterEstimationComposition: Provide expected result instead of relying on tolerance requirements: update dill requirement from <0.3.7 to <0.3.8 (PrincetonUniversity#2743) Feat/em composition refactor learning mech (PrincetonUniversity#2754) Fix/input port combine (PrincetonUniversity#2755) requirements: update beartype requirement from <0.15.0 to <0.16.0 (PrincetonUniversity#2744)
Resolve all differences in favor of devel. master changes are stale because they mirror old commits on devel. * master: tests/ParameterEstimationComposition: Reduce the number of estimates by 40x tests/ParameterEstimationComposition: Provide expected result instead of relying on tolerance requirements: update dill requirement from <0.3.7 to <0.3.8 (PrincetonUniversity#2743) Feat/em composition refactor learning mech (PrincetonUniversity#2754) Fix/input port combine (PrincetonUniversity#2755) requirements: update beartype requirement from <0.15.0 to <0.16.0 (PrincetonUniversity#2744)
Resolve all differences in favor of devel. master changes are stale because they mirror old commits on devel. * master: tests/ParameterEstimationComposition: Reduce the number of estimates by 40x tests/ParameterEstimationComposition: Provide expected result instead of relying on tolerance requirements: update dill requirement from <0.3.7 to <0.3.8 (PrincetonUniversity#2743) Feat/em composition refactor learning mech (PrincetonUniversity#2754) Fix/input port combine (PrincetonUniversity#2755) requirements: update beartype requirement from <0.15.0 to <0.16.0 (PrincetonUniversity#2744)
* requirements: update beartype requirement from <0.15.0 to <0.16.0 (#2744) * Fix/input port combine (#2755) • inputport.py _parse_port_specific_specs(): fix bug in which COMBINE was not parsed when specified in an InputPort specification dict (though still some weirdness in passing spec through to constructor, requiring function assignment in place) • port.py _parse_port_spec(): add passing of Context.string for local handling based on caller (e.g., warning messages) * Feat/em composition refactor learning mech (#2754) • EMstoragemechanism.py - refactor memory_matrix to use learning_signals • emcomposition.py - refactor to use memory_matrix of storage_node if that is implemented Co-authored-by: jdcpni <pniintel55> * requirements: update dill requirement from <0.3.7 to <0.3.8 (#2743) * tests/ParameterEstimationComposition: Provide expected result instead of relying on tolerance Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * tests/ParameterEstimationComposition: Reduce the number of estimates by 40x It's still enough to recover the parameters and reduces test time significantly. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> --------- Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jdcpni <jdc@princeton.edu> Co-authored-by: Jan Vesely <jan.vesely@rutgers.edu>
Resolve all differences in favor of devel. master changes are stale because they mirror old commits on devel. * master: tests/ParameterEstimationComposition: Reduce the number of estimates by 40x tests/ParameterEstimationComposition: Provide expected result instead of relying on tolerance requirements: update dill requirement from <0.3.7 to <0.3.8 (PrincetonUniversity#2743) Feat/em composition refactor learning mech (PrincetonUniversity#2754) Fix/input port combine (PrincetonUniversity#2755) requirements: update beartype requirement from <0.15.0 to <0.16.0 (PrincetonUniversity#2744)
• emcomposition.py
• test_emcomposition.py
• composition.py