A Small Usage ExampleΒΆ
Below follows a script for simulating simple instrumental training, where the subject learns to respond to a single stimulus. For additional scripts, please see the script database on the Learning Simulator Project website.
n_subjects = 10
mechanism = sr
behaviors = response, no_response
stimulus_elements = background, stimulus, reward
start_v = -1
alpha_v = 0.1
u = reward:10, default:0
@PHASE training stop: stimulus==50
START_TRIAL stimulus | response: REWARD | NO_REWARD
REWARD reward | START_TRIAL
NO_REWARD background | START_TRIAL
@run training
xscale: stimulus
@figure v(stimulus->response)
@subplot 111 {'xlabel':'exposures to stimulus', 'ylabel':'v-value'}
@vplot stimulus->response
Running this script should result in a figure similar to the one below, where we see that the value of
responding to the stimulus starts at -1 (as specified in the parameter start_v
) and tends to 10 (the u-value for the reward, as specified in the parameter u
).