MATRIX, PARAMETER_PORT, PARAMETER_PORTS, PROJECTION_SENDER, SLOPE, ONLINE, AFTER from psyneulink.core.globals.parameters import Parameter from psyneulink.core.globals.preferences.basepreferenceset import is_pref_set from psyneulink.core.globals.preferences.preferenceset import PreferenceLevel from psyneulink.core.globals.utilities import iscompatible, parameter_spec __all__ = [ 'DefaultTrainingMechanism', 'LearningProjection', 'LearningProjectionError', 'WT_MATRIX_RECEIVERS_DIM', 'WT_MATRIX_SENDER_DIM', ] # Parameters: parameter_keywords.update({LEARNING_PROJECTION, LEARNING}) projection_keywords.update({LEARNING_PROJECTION, LEARNING}) WT_MATRIX_SENDER_DIM = 0 WT_MATRIX_RECEIVERS_DIM = 1 DefaultTrainingMechanism = ObjectiveMechanism class LearningProjectionError(Exception): def __init__(self, error_value): self.error_value = error_value def __str__(self): return repr(self.error_value)
from psyneulink.core.components.functions.transferfunctions import LinearMatrix, get_matrix from psyneulink.core.components.projections.pathway.mappingprojection import MappingProjection from psyneulink.core.components.projections.projection import projection_keywords from psyneulink.core.components.shellclasses import Mechanism from psyneulink.core.components.ports.outputport import OutputPort from psyneulink.core.globals.context import ContextFlags from psyneulink.core.globals.keywords import AUTO_ASSOCIATIVE_PROJECTION, DEFAULT_MATRIX, HOLLOW_MATRIX, MATRIX from psyneulink.core.globals.parameters import Parameter from psyneulink.core.globals.preferences.basepreferenceset import is_pref_set from psyneulink.core.globals.preferences.preferenceset import PreferenceLevel __all__ = [ 'AutoAssociativeError', 'AutoAssociativeProjection', 'get_auto_matrix', 'get_hetero_matrix', ] parameter_keywords.update({AUTO_ASSOCIATIVE_PROJECTION}) projection_keywords.update({AUTO_ASSOCIATIVE_PROJECTION}) class AutoAssociativeError(Exception): def __init__(self, error_value): self.error_value = error_value def _matrix_getter(owning_component=None, context=None): return owning_component.owner_mech.parameters.matrix._get(context) def _matrix_setter(value, owning_component=None, context=None): owning_component.owner_mech.parameters.matrix._set(value, context) return value
from psyneulink.core.components.projections.projection import ProjectionError, Projection_Base, projection_keywords from psyneulink.core.components.ports.outputport import OutputPort from psyneulink.core.globals.keywords import \ AUTO_ASSIGN_MATRIX, CONTEXT, DEFAULT_MATRIX, FULL_CONNECTIVITY_MATRIX, FUNCTION, FUNCTION_PARAMS, \ HOLLOW_MATRIX, IDENTITY_MATRIX, INPUT_PORT, LEARNING, LEARNING_PROJECTION, MAPPING_PROJECTION, MATRIX, \ OUTPUT_PORT, PROJECTION_SENDER, VALUE from psyneulink.core.globals.log import ContextFlags from psyneulink.core.globals.parameters import FunctionParameter, Parameter from psyneulink.core.globals.preferences.basepreferenceset import is_pref_set from psyneulink.core.globals.preferences.preferenceset import PreferenceEntry, PreferenceLevel __all__ = [ 'MappingError', 'MappingProjection', ] parameter_keywords.update({MAPPING_PROJECTION}) projection_keywords.update({MAPPING_PROJECTION}) class MappingError(Exception): def __init__(self, error_value): self.error_value = error_value def _mapping_projection_matrix_getter(owning_component=None, context=None): return owning_component.function.parameters.matrix.get(context) def _mapping_projection_matrix_setter(value, owning_component=None, context=None): owning_component.function.parameters.matrix.set(value, context) # KDM 11/13/18: not sure that below is correct to do here, probably is better to do this in a "reset" type
from psyneulink.core.components.projections.modulatory.modulatoryprojection import ModulatoryProjection_Base from psyneulink.core.components.projections.projection import ProjectionError, Projection_Base, projection_keywords from psyneulink.core.components.shellclasses import Mechanism, Process_Base from psyneulink.core.globals.context import ContextFlags from psyneulink.core.globals.keywords import CONTROL, CONTROL_PROJECTION, CONTROL_SIGNAL, PARAMETER_STATE, PROJECTION_SENDER from psyneulink.core.globals.parameters import Parameter from psyneulink.core.globals.preferences.componentpreferenceset import is_pref_set from psyneulink.core.globals.preferences.preferenceset import PreferenceLevel __all__ = [ 'CONTROL_SIGNAL_PARAMS', 'ControlProjection', 'ControlProjectionError', ] parameter_keywords.update({CONTROL_PROJECTION, CONTROL}) projection_keywords.update({CONTROL_PROJECTION, CONTROL}) CONTROL_SIGNAL_PARAMS = 'control_signal_params' class ControlProjectionError(Exception): def __init__(self, error_value): self.error_value = error_value def __str__(self): return repr(self.error_value) def _control_signal_getter(owning_component=None, execution_id=None): return owning_component.sender.parameters.value.get(execution_id)
from psyneulink.core.components.projections.modulatory.modulatoryprojection import ModulatoryProjection_Base from psyneulink.core.components.projections.projection import ProjectionError, Projection_Base, projection_keywords from psyneulink.core.components.shellclasses import Mechanism, Process_Base from psyneulink.core.globals.context import ContextFlags from psyneulink.core.globals.keywords import \ FUNCTION_OUTPUT_TYPE, GATING, GATING_MECHANISM, GATING_PROJECTION, GATING_SIGNAL, \ INPUT_PORT, OUTPUT_PORT, PROJECTION_SENDER from psyneulink.core.globals.parameters import Parameter from psyneulink.core.globals.preferences.basepreferenceset import is_pref_set from psyneulink.core.globals.preferences.preferenceset import PreferenceLevel __all__ = [ 'GATING_SIGNAL_PARAMS', 'GatingProjection', 'GatingProjectionError', ] parameter_keywords.update({GATING_PROJECTION, GATING}) projection_keywords.update({GATING_PROJECTION, GATING}) GATING_SIGNAL_PARAMS = 'gating_signal_params' class GatingProjectionError(Exception): def __init__(self, error_value): self.error_value = error_value def __str__(self): return repr(self.error_value) def _gating_signal_getter(owning_component=None, context=None): return owning_component.sender.parameters.value._get(context)