hetero=-2,
                                                    integration_rate=0.01,
                                                    name='WORDS_HIDDEN')

#   Response layer, responses: ('red', 'green')
response_layer = pnl.RecurrentTransferMechanism(size=2,
                                                function=pnl.Logistic(),
                                                hetero=-2.0,
                                                integrator_mode=True,
                                                integration_rate=0.01,
                                                output_ports = [pnl.RESULT,
                                                                 {pnl.NAME: 'DECISION_ENERGY',
                                                                  pnl.VARIABLE: (pnl.OWNER_VALUE,0),
                                                                  pnl.FUNCTION: pnl.Stability(
                                                                          default_variable = np.array([0.0, 0.0]),
                                                                          metric = pnl.ENERGY,
                                                                          matrix = np.array([[0.0, -4.0],
                                                                                             [-4.0, 0.0]]))}],
                                                name='RESPONSE', )

# Mapping projections---------------------------------------------------------------------------------------------------

color_input_weights = pnl.MappingProjection(matrix=np.array([[1.0, 0.0, 0.0],
                                                             [0.0, 1.0, 0.0],
                                                             [0.0, 0.0, 1.0]]))

word_input_weights = pnl.MappingProjection(matrix=np.array([[1.0, 0.0, 0.0],
                                                            [0.0, 1.0, 0.0],
                                                            [0.0, 0.0, 1.0]]))

task_input_weights = pnl.MappingProjection(matrix=np.array([[1.0, 0.0],
Example #2
0
        {
            pnl.NAME: 'REWARD RATE',
            # pnl.VARIABLE: [pnl.OWNER_VALUE],
            pnl.VARIABLE: [(pnl.OWNER_VALUE, 0)],
            pnl.FUNCTION: pnl.AdaptiveIntegrator(rate=0.2)
        },
        {
            pnl.NAME:
            'CONFLICT K',
            # pnl.VARIABLE: [pnl.OWNER_VALUE],
            pnl.VARIABLE: [(pnl.OWNER_VALUE, 0)],
            #Jon said this should also work and would be safer: [(pnl.OWNER_VALUE, 0),
            #(pnl.OWNER_VALUE, 1)], but it doesn't work (maybe I did sth wrong)
            pnl.FUNCTION:
            pnl.Stability(default_variable=[0, 0],
                          metric=pnl.ENERGY,
                          normalize=True)
        },
    ],
    #as stated in the paper 'Response conflict was calculated as a normalized                                                                   measure of the energy in the response units during the trial'
    name='Action Selection')

# rate = pnl.ObjectiveMechanism(monitored_output_states=[action_selection.output_states[0]],
#                               function=pnl.AdaptiveIntegrator(rate=0.2,
#                                                               noise=reward,
#                                                               time_step_size=0.02),
#                               name='REWARD RATE')

# K = pnl.ObjectiveMechanism(#size=1,
#                           monitored_output_states=[action_selection.output_state],
#                           function=pnl.Stability(metric=pnl.ENERGY,
Example #3
0
#should be randomly distributed noise to the net input of each unit (except input unit)

# Now a RecurrentTransferMechanism compared to Lauda's Stroop model!
response_layer = pnl.RecurrentTransferMechanism(
    size=2,  #Recurrent
    function=pnl.
    Logistic,  #pnl.Stability(matrix=np.matrix([[0.0, -1.0], [-1.0, 0.0]])),
    name='RESPONSE',
    output_states=[
        pnl.RECURRENT_OUTPUT.RESULT, {
            pnl.NAME:
            'DECISION_ENERGY',
            pnl.VARIABLE: (pnl.OWNER_VALUE, 0),
            pnl.FUNCTION:
            pnl.Stability(default_variable=np.array([0.0, -1.0]),
                          metric=pnl.ENERGY,
                          matrix=np.array([[0.0, -1.0], [-1.0, 0.0]]))
        }
    ],
    integrator_mode=True,  #)
    # noise=pnl.NormalDist(mean=0.0, standard_dev=.01).function)
    smoothing_factor=0.1)

#response_layer.set_log_conditions('value')
#response_layer.set_log_conditions('gain')

#   SET UP CONNECTIONS
#   rows correspond to sender
#   columns correspond to: weighting of the contribution that a given sender makes to the receiver
#   in linear algebra terms can write out the matrix
#   Input to hidden
Example #4
0
def test_Stability_squeezes_variable():
    s1 = pnl.Stability(default_variable=[[0.0, 0.0]])
    s2 = pnl.Stability(default_variable=[0.0, 0.0])

    assert s1.execute([5, 5]) == s2.execute([5, 5])