task_decision.set_log_conditions('PROBABILITY_LOWER_THRESHOLD') task_decision.set_log_conditions('PROBABILITY_UPPER_THRESHOLD') print("task decision loggables: ", task_decision.loggable_items) lvoc = pnl.LVOCControlMechanism( name='LVOC ControlMechanism', feature_predictors={pnl.SHADOW_EXTERNAL_INPUTS: [color_stim, word_stim]}, objective_mechanism=pnl.ObjectiveMechanism( name='LVOC ObjectiveMechanism', monitored_output_states=[task_decision, reward], function=objective_function), prediction_terms=[pnl.PV.FC, pnl.PV.COST], terminal_objective_mechanism=True, # learning_function=pnl.BayesGLM(mu_0=0, sigma_0=0.1), learning_function=pnl.BayesGLM(mu_0=-0.17, sigma_0=0.11), # function=pnl.GradientOptimization( # convergence_criterion=pnl.VALUE, # convergence_threshold=0.001, # step_size=1, # annealing_function= lambda x,y : x / np.sqrt(y), # # direction=pnl.ASCENT # ), function=pnl.GridSearch, # function=pnl.OptimizationFunction, # control_signals={'COLOR CONTROL':[(pnl.SLOPE, color_task), # ('color_control', word_task)]} # control_signals={pnl.NAME:'COLOR CONTROL',
lvoc = pnl.OptimizationControlMechanism( name='LVOC ControlMechanism', features=[color_stim.input_state, word_stim.input_state], # features={pnl.SHADOW_EXTERNAL_INPUTS: [color_stim, word_stim]}, objective_mechanism=pnl.ObjectiveMechanism( name='LVOC ObjectiveMechanism', monitor=[ task_decision.output_states[pnl.PROBABILITY_UPPER_THRESHOLD], task_decision.output_states[pnl.PROBABILITY_LOWER_THRESHOLD], reward ], # monitored_output_states=[task_decision, reward], function=objective_function), agent_rep=pnl.RegressionCFA( update_weights=pnl.BayesGLM( mu_0=-0.17, sigma_0=9.0909), # -0.17, 9.0909 precision = 0.11; 1/p = v prediction_terms=[pnl.PV.FC, pnl.PV.COST]), function=pnl.GradientOptimization( convergence_criterion=pnl.VALUE, convergence_threshold=0.001, #0.001 step_size=1, #1 annealing_function=lambda x, y: x / np.sqrt(y) # direction=pnl.ASCENT ), control_signals=pnl.ControlSignal( projections=[(pnl.SLOPE, color_task), ('color_control', word_task)], # function=pnl.ReLU, function=pnl.Logistic, cost_options=[ pnl.ControlSignalCosts.INTENSITY, pnl.ControlSignalCosts.ADJUSTMENT
features=[color_stim.input_port, word_stim.input_port], # features={pnl.SHADOW_EXTERNAL_INPUTS: [color_stim, word_stim]}, # computes value of processing, reward received objective_mechanism=pnl.ObjectiveMechanism( name='LVOC ObjectiveMechanism', monitor=[ task_decision.output_ports[pnl.PROBABILITY_UPPER_THRESHOLD], task_decision.output_ports[pnl.PROBABILITY_LOWER_THRESHOLD], reward, task_decision.output_ports[pnl.RESPONSE_TIME] ], function=objective_function), # posterior weight distribution agent_rep=pnl.RegressionCFA( # update_weights=pnl.BayesGLM(mu_0=-0.17, sigma_0=0.11), #sigma_0=math.sqrt(0.11)) update_weights=pnl.BayesGLM( mu_0=-0.17, sigma_0=0.0000000000000001), #sigma_0=math.sqrt(0.11)) # update_weights=pnl.BayesGLM(mu_0=+0.17, sigma_0=0.11), #sigma_0=math.sqrt(0.11)) prediction_terms=[pnl.PV.C, pnl.PV.FC, pnl.PV.FF, pnl.PV.COST]), # sample control allocs, and return best # evaluate() computes outcome (obj mech) - costs given state (features) and sample ctrl alloc function=pnl.GradientOptimization( convergence_criterion=pnl.VALUE, convergence_threshold=0.001, step_size=2, #1 # Note: Falk used 10 in the denom below, but indexed sample numbers from 1; # but sample_num passed to _follow_gradient is indexed from 0, so use 11 below annealing_function=lambda x, y: x / np.sqrt(11 + y), max_iterations=100 # save_samples=True, # save_values=True, # direction=pnl.ASCENT