How to use the psyneulink.core.globals.parameters.Parameter function in psyneulink

To help you get started, we’ve selected a few psyneulink examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PrincetonUniversity / PsyNeuLink / psyneulink / core / components / functions / optimizationfunctions.py View on Github external
:type: ``list``
                    :read only: True

                step_size
                    see `step_size `

                    :default value: 1.0
                    :type: ``float``
        """
        variable = Parameter([[0], [0]], read_only=True, pnl_internal=True, constructor_argument='default_variable')

        # these should be removed and use switched to .get_previous()
        previous_variable = Parameter([[0], [0]], read_only=True, pnl_internal=True, constructor_argument='default_variable')
        previous_value = Parameter([[0], [0]], read_only=True, pnl_internal=True)

        gradient_function = Parameter(None, stateful=False, loggable=False)
        step_size = Parameter(1.0, modulable=True)
        annealing_function = Parameter(None, stateful=False, loggable=False)
        convergence_threshold = Parameter(.001, modulable=True)
        max_iterations = Parameter(1000, modulable=True)
        search_space = Parameter([SampleIterator([0, 0])], stateful=False, loggable=False)

        direction = ASCENT
        convergence_criterion = Parameter(VALUE, pnl_internal=True)

        def _parse_direction(self, direction):
            if direction == ASCENT:
                return 1
            else:
                return -1

    @tc.typecheck
github PrincetonUniversity / PsyNeuLink / psyneulink / core / components / functions / distributionfunctions.py View on Github external
:default value: 0.0
                    :type: ``float``

                t0
                    see `t0 `

                    :default value: 0.2
                    :type: ``float``

                threshold
                    see `threshold `

                    :default value: 1.0
                    :type: ``float``
        """
        drift_rate = Parameter(1.0, modulable=True, aliases=[MULTIPLICATIVE_PARAM])
        starting_point = Parameter(0.0, modulable=True, aliases=[ADDITIVE_PARAM])
        threshold = Parameter(1.0, modulable=True)
        noise = Parameter(0.5, modulable=True)
        t0 = .200
        bias = Parameter(0.5, read_only=True, getter=_DriftDiffusionAnalytical_bias_getter)
        # this is read only because conversion is disabled for this function
        # this occurs in other places as well
        enable_output_type_conversion = Parameter(
            False,
            stateful=False,
            loggable=False,
            pnl_internal=True,
            read_only=True
        )

    @tc.typecheck
github PrincetonUniversity / PsyNeuLink / psyneulink / core / components / mechanisms / modulatory / control / optimizationcontrolmechanism.py View on Github external
search_statefulness
                    see `search_statefulness `

                    :default value: True
                    :type: ``bool``

                search_termination_function
                    see `search_termination_function `

                    :default value: None
                    :type:
        """
        function = Parameter(None, stateful=False, loggable=False)
        feature_function = Parameter(None, reference=True, stateful=False, loggable=False)
        search_function = Parameter(None, stateful=False, loggable=False)
        search_termination_function = Parameter(None, stateful=False, loggable=False)
        comp_execution_mode = Parameter('Python', stateful=False, loggable=False, pnl_internal=True)
        search_statefulness = Parameter(True, stateful=False, loggable=False)

        agent_rep = Parameter(None, stateful=False, loggable=False, pnl_internal=True, structural=True)

        feature_values = Parameter(_parse_feature_values_from_variable([defaultControlAllocation]), user=False, pnl_internal=True)

        input_ports = Parameter(
            [{NAME: OUTCOME, PARAMS: {INTERNAL_ONLY: True}}],
            stateful=False,
            loggable=False,
            read_only=True,
            structural=True,
            parse_spec=True,
            aliases='features',
github PrincetonUniversity / PsyNeuLink / psyneulink / core / components / functions / statefulfunctions / memoryfunctions.py View on Github external
storage_prob
                    see `storage_prob `

                    :default value: 1.0
                    :type: ``float``

                val_size
                    see `val_size `

                    :default value: 1
                    :type: ``int``
        """
        variable = Parameter([[0],[0]], pnl_internal=True, constructor_argument='default_variable')
        retrieval_prob = Parameter(1.0, modulable=True)
        storage_prob = Parameter(1.0, modulable=True, aliases=[MULTIPLICATIVE_PARAM])
        key_size = Parameter(1, stateful=True)
        val_size = Parameter(1, stateful=True)
        duplicate_keys = Parameter(False)
        equidistant_keys_select = Parameter(RANDOM)
        rate = Parameter(1.0, modulable=True)
        noise = Parameter(0.0, modulable=True, aliases=[ADDITIVE_PARAM])
        max_entries = Parameter(1000)
        random_state = Parameter(None, stateful=True, loggable=False)

        distance_function = Parameter(Distance(metric=COSINE), stateful=False, loggable=False)
        selection_function = Parameter(OneHot(mode=MIN_INDICATOR), stateful=False, loggable=False)


    @tc.typecheck
    def __init__(self,
                 default_variable=None,
github PrincetonUniversity / PsyNeuLink / psyneulink / core / components / functions / statefulfunctions / memoryfunctions.py View on Github external
:default value: 1
                    :type: ``int``
        """
        variable = Parameter([[0],[0]], pnl_internal=True, constructor_argument='default_variable')
        retrieval_prob = Parameter(1.0, modulable=True)
        storage_prob = Parameter(1.0, modulable=True, aliases=[MULTIPLICATIVE_PARAM])
        key_size = Parameter(1, stateful=True)
        val_size = Parameter(1, stateful=True)
        duplicate_keys = Parameter(False)
        equidistant_keys_select = Parameter(RANDOM)
        rate = Parameter(1.0, modulable=True)
        noise = Parameter(0.0, modulable=True, aliases=[ADDITIVE_PARAM])
        max_entries = Parameter(1000)
        random_state = Parameter(None, stateful=True, loggable=False)

        distance_function = Parameter(Distance(metric=COSINE), stateful=False, loggable=False)
        selection_function = Parameter(OneHot(mode=MIN_INDICATOR), stateful=False, loggable=False)


    @tc.typecheck
    def __init__(self,
                 default_variable=None,
                 retrieval_prob: tc.optional(tc.any(int, float))=1.0,
                 storage_prob: tc.optional(tc.any(int, float))=1.0,
                 noise: tc.optional(tc.any(int, float, list, np.ndarray, callable))=0.0,
                 rate: tc.optional(tc.any(int, float, list, np.ndarray))=1.0,
                 initializer=None,
                 distance_function:tc.optional(tc.any(Distance, is_function_type))=None,
                 selection_function:tc.optional(tc.any(OneHot, is_function_type))=None,
                 duplicate_keys:tc.any(bool, tc.enum(OVERWRITE))=False,
                 equidistant_keys_select:tc.enum(RANDOM, OLDEST, NEWEST)=RANDOM,
                 max_entries=1000,
github PrincetonUniversity / PsyNeuLink / psyneulink / library / components / mechanisms / processing / transfer / kohonenmechanism.py View on Github external
:type: ``str``

                output_ports
                    see `output_ports `

                    :default value: [`RESULT`, "{name: INPUT_PATTERN, variable: OWNER_VARIABLE}"]
                    :type: ``list``
                    :read only: True
        """
        learning_function = Parameter(
            Kohonen(distance_function=GAUSSIAN),
            stateful=False,
            loggable=False,
            reference=True
        )
        learning_rate = Parameter(None, modulable=True)
        enable_learning = True
        matrix = DEFAULT_MATRIX

        output_ports = Parameter(
            [RESULT, {NAME: INPUT_PATTERN, VARIABLE: OWNER_VARIABLE}],
            stateful=False,
            loggable=False,
            read_only=True,
            structural=True,
        )

    standard_output_ports = TransferMechanism.standard_output_ports.copy()
    standard_output_ports.extend([{NAME:MAXIMUM_ACTIVITY,
                                    VARIABLE:(OWNER_VALUE,0),
                                    FUNCTION: OneHot(mode=MAX_INDICATOR)}
                                   ])
github PrincetonUniversity / PsyNeuLink / psyneulink / core / components / ports / modulatorysignals / gatingsignal.py View on Github external
:type: ``numpy.ndarray``
                    :read only: True

                allocation_samples
                    see `allocation_samples `

                    :default value: None
                    :type:

                modulation
                    see `modulation `

                    :default value: None
                    :type:
        """
        variable = Parameter(np.array([defaultGatingAllocation]),
                             aliases='allocation',
                             getter=_output_port_variable_getter,
                             pnl_internal=True, constructor_argument='default_variable'
        )
        value = Parameter(np.array([defaultGatingAllocation]), read_only=True, aliases=['intensity'], pnl_internal=True)
        allocation_samples = Parameter(None, modulable=True)
        modulation = None

        # # Override ControlSignal cost-related attributes and functions
        # cost_options = None
        # intensity_cost = None
        # adjustment_cost = None
        # duration_cost = None
        # cost = None
        # intensity_cost_function = None
        # adjustment_cost_function = None
github PrincetonUniversity / PsyNeuLink / psyneulink / library / components / mechanisms / processing / transfer / kwtamechanism.py View on Github external
:default value: 0.5
                    :type: ``float``

                ratio
                    see `ratio `

                    :default value: 0.5
                    :type: ``float``

                threshold
                    see `threshold `

                    :default value: 0.0
                    :type: ``float``
        """
        function = Parameter(Logistic, stateful=False, loggable=False)
        k_value = Parameter(0.5, modulable=True)
        threshold = Parameter(0.0, modulable=True)
        ratio = Parameter(0.5, modulable=True)

        average_based = False
        inhibition_only = True

    @tc.typecheck
    def __init__(self,
                 default_variable=None,
                 size=None,
                 function=Logistic,
                 matrix=None,
                 auto: is_numeric_or_none=None,
                 hetero: is_numeric_or_none=None,
                 integrator_function=AdaptiveIntegrator,
github PrincetonUniversity / PsyNeuLink / psyneulink / library / components / mechanisms / modulatory / control / evc / evcauxiliary.py View on Github external
:type:

                rate
                    see `rate `

                    :default value: 1.0
                    :type: float

                window_size
                    see `window_size `

                    :default value: 1
                    :type: int

        """
        window_size = Parameter(1, stateful=False, loggable=False)
        filter_function = Parameter(None, stateful=False, loggable=False)
        input_type = None

        rate = Parameter(1.0, modulable=True)

    @tc.typecheck
    @handle_external_context(source=None)
    def __init__(self,
                 default_variable=None,
                 size=None,
                 input_ports:tc.optional(tc.any(list, dict))=None,
                 function:tc.optional(tc.enum(
                         INPUT, TIME_AVERAGE_INPUT, AVERAGE_INPUTS, INPUT_SEQUENCE))=TIME_AVERAGE_INPUT,
                 initial_value=None,
                 # rate:tc.optional(tc.any(int, float))=1.0,
                 # noise:tc.optional(tc.any(int, float, callable))=0.0,
github PrincetonUniversity / PsyNeuLink / psyneulink / core / components / states / inputstate.py View on Github external
specifies whether InputState shadows inputs of another InputState;
                    if not None, must be assigned another InputState

                    :default value: None
                    :type: InputState
                    :read only: True

                weight
                    see `weight `

                    :default value: None
                    :type:

        """
        function = Parameter(LinearCombination(operation=SUM), stateful=False, loggable=False)
        weight = Parameter(None, modulable=True)
        exponent = Parameter(None, modulable=True)
        combine = None
        internal_only = Parameter(False, stateful=False, loggable=False, pnl_internal=True)
        shadow_inputs = Parameter(None, stateful=False, loggable=False, read_only=True, pnl_internal=True)

    paramClassDefaults = State_Base.paramClassDefaults.copy()
    paramClassDefaults.update({PROJECTION_TYPE: MAPPING_PROJECTION,
                               MECHANISM: None,     # These are used to specifiy InputStates by projections to them
                               OUTPUT_STATES: None  # from the OutputStates of a particular Mechanism (see docs)
                               })
    #endregion

    @handle_external_context()
    @tc.typecheck
    def __init__(self,
                 owner=None,