tasks.beads module

Author:Dominic Hunt
Reference:Jumping to conclusions: a network model predicts schizophrenic patients’ performance on a probabilistic reasoning task. Moore, S. C., & Sellen, J. L. (2006). Cognitive, Affective & Behavioral Neuroscience, 6(4), 261–9. Retrieved from http://www.ncbi.nlm.nih.gov/pubmed/17458441
class tasks.beads.Beads(N=None, beadSequence=[1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0])[source]

Bases: tasks.taskTemplate.Task

Based on the Moore & Sellen Beads task

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:
  • N (int, optional) – Number of beads that could potentially be shown
  • beadSequence (list or array of {0,1}, optional) – The sequence of beads to be shown. Bead sequences can also be embedded in the code and then referred to by name. The only current one is MooreSellen, the default sequence.
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.beads.RewardBeadDirect(**kwargs)[source]

Bases: model.modelTemplate.Rewards

Processes the beads reward for models expecting just the reward

processFeedback(feedback, lastAction, stimuli)[source]
Returns:
Return type:modelFeedback
class tasks.beads.StimulusBeadDirect(**kwargs)[source]

Bases: model.modelTemplate.Stimulus

Processes the beads stimuli for models expecting just the event

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)
class tasks.beads.StimulusBeadDualDirect(**kwargs)[source]

Bases: model.modelTemplate.Stimulus

Processes the beads stimuli for models expecting a tuple of [event,1-event]

processStimulus(observation)[source]

Processes the decks stimuli for models expecting just the event

Returns:
  • stimuliPresent (int or list of int) – The elements present of the stimulus
  • stimuliActivity (float or list of float) – The activity of each of the elements
class tasks.beads.StimulusBeadDualInfo(**kwargs)[source]

Bases: model.modelTemplate.Stimulus

Processes the beads stimuli for models expecting the reward information from two possible actions

Parameters:oneProb (float in [0,1]) – The probability of a 1 from the first jar. This is also the probability of a 0 from the second jar. event_info is calculated as oneProb*event + (1-oneProb)*(1-event)
oneProb = [0, 1]
processStimulus(observation)[source]

Processes the decks stimuli for models expecting just the event

Returns:
  • stimuliPresent (int or list of int) – The elements present of the stimulus
  • stimuliActivity (float or list of float) – The activity of each of the elements
tasks.beads.generateSequence(numBeads, oneProb, switchProb)[source]

Designed to generate a sequence of beads with a probability of switching jar at any time.

Parameters:
  • numBeads (int) – The number of beads in the sequence
  • oneProb (float in [0,1]) – The probability of a 1 from the first jar. This is also the probability of a 0 from the second jar.
  • switchProb (float in [0,1]) – The probability that the drawn beads change the jar they are being drawn from
Returns:

sequence – The generated sequence of beads

Return type:

list of {0,1}