drbenvincent / darc_toolbox

Run adaptive decision making experiments
MIT License
16 stars 2 forks source link

Define the API for DARC experiments #8

Closed drbenvincent closed 5 years ago

drbenvincent commented 5 years ago

While we have Kirby and Frye et al paradigms available, the focus of the toolbox was to use the Bayesian Adaptive Designs on the DARC paradigm.

At the moment, the design is decided by a small snippet of Python code embedded within PsychoPy. This creates a design object which provides designs for each trial, and accepts the (design, response) pairs for each trial.

What we want, is a concise, easy to understand way to allow people to decide the following:

Decisions

However... We do want it to be very easy for people to just ask for a delayed or risky or delayed and risky choice tasks. So we could either do 3 corresponding subclasses, or something snazzy with input arguments that can be either a set of design parameters of a general class of experiment.

No... don't have loads of different classes for just different input options. Instead do one of the following:

drbenvincent commented 5 years ago

What we have now is reasonable. In PsychoPy we have this code snippet which allows people to specify what they want by setting what_I_want. This code could be hidden away in a function, but my hunch is that we should keep it here - this is more transparent and it's very clear to the experimenter how to change parameters to suit their needs without digging around in code. While it's not hard, I must try to remember to keep the barriers to entry as low as possible.

what_I_want = 'delayed_choice_task'

if what_I_want is 'delayed_choice_task':

    # create an appropriate model object
    from darc.delayed import models
    model = models.Hyperbolic(n_particles=5_000)

    # create an appropriate design object
    design_thing = DARC_Designs(max_trials=12)

elif what_I_want is 'risky_choice_task':

    # create an appropriate model object
    from darc.risky import models
    model = models.Hyperbolic(n_particles=5_000)

    # create an appropriate design object
    design_thing = DARC_Designs(max_trials=12, 
        DA=[0], DB=[0], PB=[0.1, 0.2, 0.25, 0.5, 0.75, 0.8, 0.9, 0.99])

elif what_I_want is 'delayed_and_risky_choice_task':

    # create an appropriate model object
    from darc.delayed_and_risky import models
    model = models.MultiplicativeHyperbolic(n_particles=5_000)

    # create an appropriate design object
    design_thing = DARC_Designs(max_trials=12, 
        PB=[0.1, 0.2, 0.25, 0.5, 0.75, 0.8, 0.9, 0.99])

else:
    print('I don''t know what you want of me!')
    raise ValueError('value provided for `what_I_want` is not recognised')

I think this is sufficient for now. Might need to come back to this after some user testing. But it's pretty simple and flexible at this point.