tasks.probSelect module

Author:Dominic Hunt
Reference:Genetic triple dissociation reveals multiple roles for dopamine in reinforcement learning. Frank, M. J., Moustafa, A. a, Haughey, H. M., Curran, T., & Hutchison, K. E. (2007). Proceedings of the National Academy of Sciences of the United States of America, 104(41), 16311–16316. doi:10.1073/pnas.0706111104
class tasks.probSelect.ProbSelect(reward_probability=0.7, learning_action_pairs=None, action_reward_probabilities=None, learning_length=240, test_length=60, number_actions=None, reward_size=1)[source]

Bases: tasks.taskTemplate.Task

Probabilistic selection task based on Genetic triple dissociation reveals multiple roles for dopamine in reinforcement learning.
Frank, M. J., Moustafa, A. a, Haughey, H. M., Curran, T., & Hutchison, K. E. (2007). Proceedings of the National Academy of Sciences of the United States of America, 104(41), 16311–16316. doi:10.1073/pnas.0706111104

Many methods are inherited from the tasks.taskTemplate.Task class. Refer to its documentation for missing methods.

Name

The name of the class used when recording what has been used.

Type:string
Parameters:
  • reward_probability (float in range [0,1], optional) – The probability that a reward is given for choosing action A. Default is 0.7
  • action_reward_probabilities (dictionary, optional) – A dictionary of the potential actions that can be taken and the probability of a reward. Default {0:rewardProb, 1:1-rewardProb, 2:0.5, 3:0.5}
  • learning_action_pairs (list of tuples, optional) – The pairs of actions shown together in the learning phase.
  • learning_length (int, optional) – The number of trials in the learning phase. Default is 240
  • test_length (int, optional) – The number of trials in the test phase. Default is 60
  • reward_size (float, optional) – The size of reward given if successful. Default 1
  • number_actions (int, optional) – The number of actions that can be chosen at any given time, chosen at random from actRewardProb. Default 4

Notes

The task is broken up into two sections: a learning phase and a transfer phase. Participants choose between pairs of four actions: A, B, M1 and M2. Each provides a reward with a different probability: A:P>0.5, B:1-P<0.5, M1=M2=0.5. The transfer phase has all the action pairs but no feedback. This class only covers the learning phase, but models are expected to be implemented as if there is a transfer phase.

feedback()[source]

Responds to the action from the participant

next()[source]

Produces the next stimulus for the iterator

Returns:
  • stimulus (None)
  • next_valid_actions (Tuple of length 2 of ints) – The list of valid actions that the model can respond with.
Raises:StopIteration
proceed()[source]

Updates the task after feedback

receiveAction(action)[source]

Receives the next action from the participant

Parameters:action (int or string) – The action taken by the model
returnTaskState()[source]

Returns all the relevant data for this task run

Returns:results – A dictionary containing the class parameters as well as the other useful data
Return type:dictionary
storeState()[source]

Stores the state of all the important variables so that they can be output later

class tasks.probSelect.RewardProbSelectDirect(**kwargs)[source]

Bases: model.modelTemplate.Rewards

Processes the probabilistic selection reward for models expecting just the reward

processFeedback(reward, action, stimuli)[source]
Returns:
Return type:modelFeedback
class tasks.probSelect.StimulusProbSelectDirect(**kwargs)[source]

Bases: model.modelTemplate.Stimulus

Processes the selection stimuli for models expecting just the event

Examples

>>> stim = StimulusProbSelectDirect()
>>> stim.processStimulus(1)
(1, 1)
>>> stim.processStimulus(0)
(1, 1)
processStimulus(observation)[source]

Processes the decks stimuli for models expecting just the event

Returns:
  • stimuliPresent (int or list of int)
  • stimuliActivity (float or list of float)