Exemple #1
0
# Create mechanisms ---------------------------------------------------------------------------------------------------

# Input Layer --- [ Target, Distractor ]
input_layer = pnl.TransferMechanism(size=2,
                                    initial_value=np.array([[0.0, 0.0]]),
                                    name='INPUT LAYER')

# Create Decision Layer  --- [ Target, Distractor ]

decision_layer = pnl.LCA(
    size=2,
    time_step_size=dt,
    leak=-1.0,
    self_excitation=w_XiXi,
    competition=w_XiXj,
    #  Recurrent matrix: [  w_XiXi   -w_XiXj ]
    #                    [ -w_XiXj    w_XiXi ]
    function=pnl.Logistic(bias=b_decision),
    noise=pnl.NormalDist(standard_dev=SD).function,
    integrator_mode=True,
    name='DECISION LAYER')

# Create Response Layer  --- [ Target ]

response_layer = pnl.LCA(
    size=1,
    time_step_size=dt,
    leak=-1.0,
    self_excitation=w_X3X3,
    #  Recurrent matrix: [w_X3X3]
    #  Competition param does not apply because there is only one unit
Exemple #2
0
# WEIGHTS TO COME FROM SEBASTIAN

example_stimulus_inputs = [[1, 0, 0, 1], [1, 0, 1, 0]]
example_task_inputs = [[0, 0, 0, 1], [1, 0, 0, 0]]
example_training_pattern = [[0, 0, 0, 1], [1, 0, 0, 0]]

# RUN THIS TO GET SPACE OF INPUTS ON WHICH TO OPTIMIZE LCA PARAMS:
inputs_to_LCA = multitasking_system.run(inputs={
    stimulus_layer: example_stimulus_inputs,
    task_layer: example_task_inputs
})

# SOME PYTHON ALGORITHM HERE THAT SELECTS THE 2-UNIT SUBVECTOR FROM inputs_to_LCA CORRESPONDING TO THE RELEVANT TASK
# AS INPUT TO optimization_system BELOW, AND THEN RUN THE SYSTEM FOR EACH INPUT, USING EVC TO OPTIMIZE LCA PARAMETERS
#  FOR EACH, BASED CONTROL PARAMETERS AND OBJECTIVE FUNCTION

input_layer = pnl.TransferMechanism(size=2)
decision_layer = pnl.LCA(
    size=2,
    # INCLUDE TERMINATION CONDITION USING THREHSOLD = ControlSignal)
)
decision_process = pnl.Process(input_layer, decision_layer)
optimization_system = pnl.System(
    processes=decision_process,
    monitor_for_control=[decision_layer.output_states[pnl.RESULT]])
# ADD COMPARATOR MECHANISM FOR ACCURACY DETERMINATION

# EVC PARAMS:
# - number of simulations to run per LCA
# - which inputs to provide (i.e., *NOT* using typical PredictionMechanisms)
Exemple #3
0
# Input Layer --- [ Target 1, Target 2, Distractor ]

# First, we create the 3 layers of the behavioral network, i.e. INPUT LAYER, DECISION LAYER, and RESPONSE LAYER.
input_layer = pnl.TransferMechanism(
    size=3,                      # Number of units in input layer
    initial_value=[[0.0, 0.0, 0.0]],     # Initial input values
    name='INPUT LAYER'                  # Define the name of the layer; this is optional,
)                 # but will help you to overview your model later on

# Create Decision Layer  --- [ Target 1, Target 2, Distractor ]
decision_layer = pnl.LCA(
    size=3,                            # Number of units in input layer
    initial_value=[[0.0, 0.0, 0.0]],    # Initial input values
    time_step_size=dt,                 # Integration step size
    leak=-1.0,                         # Sets off diagonals to negative values
    self_excitation=selfdwt,           # Set diagonals to self excitate
    competition=inhwt,                 # Set off diagonals to inhibit
    function=pnl.Logistic(bias=decbias),   # Set the Logistic function with bias = decbias
    # noise=pnl.UniformToNormalDist(standard_dev = SD).function, # The UniformToNormalDist function will
    integrator_mode=True,               # set the noise with a seed generator that is compatible with
    name='DECISION LAYER'               # MATLAB random seed generator 22 (rsg=22)
)

# decision_layer.set_log_conditions('RESULT')  # Log RESULT of the decision layer
decision_layer.set_log_conditions('value')  # Log value of the decision layer

for output_state in decision_layer.output_states:
    output_state.value *= 0.0                                       # Set initial output values for decision layer to 0

# Create Response Layer  --- [ Target1, Target2 ]
response_layer = pnl.LCA(
    size=2,                                        # Number of units in input layer