def test_DARC_BAD_alt_delayandrisky(): D = DesignSpaceBuilder.delayed_and_risky().build() design_thing = BayesianAdaptiveDesignGeneratorDARC(D, max_trials=3) assert isinstance(design_thing, BayesianAdaptiveDesignGeneratorDARC)
def act_on_choices(desired_experiment_type, desired_model, expInfo): # create desired experiment object ======================================== if desired_experiment_type == 'delayed (Bayesian Adaptive Design)': from darc.designs import BayesianAdaptiveDesignGeneratorDARC, DesignSpaceBuilder # regular, or magnitude effect if (desired_model is 'HyperbolicMagnitudeEffect') or (desired_model is 'ExponentialMagnitudeEffect'): D = DesignSpaceBuilder.delay_magnitude_effect().build() design_thing = BayesianAdaptiveDesignGeneratorDARC(D, max_trials=expInfo['trials']) else: D = DesignSpaceBuilder.delayed().build() design_thing = BayesianAdaptiveDesignGeneratorDARC(D, max_trials=expInfo['trials']) # import the appropriate set of models from darc.delayed import models elif desired_experiment_type == 'delayed (Kirby 2009)': from darc.delayed.designs import Kirby2009 design_thing = Kirby2009() from darc.delayed import models elif desired_experiment_type == 'delayed (Griskevicius et al, 2011)': from darc.delayed.designs import Griskevicius2011 design_thing = Griskevicius2011() from darc.delayed import models elif desired_experiment_type == 'delayed (Frye et al, 2016)': from darc.delayed.designs import Frye design_thing = Frye() from darc.delayed import models elif desired_experiment_type == 'delayed (Du, Green, & Myerson, 2002)': from darc.delayed.designs import DuGreenMyerson2002 design_thing = DuGreenMyerson2002() from darc.delayed import models elif desired_experiment_type == 'risky (Du, Green, & Myerson, 2002)': from darc.risky.designs import DuGreenMyerson2002 design_thing = DuGreenMyerson2002() from darc.risky import models elif desired_experiment_type == 'risky (Griskevicius et al, 2011)': from darc.risky.designs import Griskevicius2011 design_thing = Griskevicius2011() from darc.risky import models elif desired_experiment_type == 'risky (Bayesian Adaptive Design)': from darc.designs import BayesianAdaptiveDesignGeneratorDARC, DesignSpaceBuilder # create an appropriate design object D = DesignSpaceBuilder.risky().build() design_thing = BayesianAdaptiveDesignGeneratorDARC(D, max_trials=expInfo['trials']) # import the appropriate set of models from darc.risky import models elif desired_experiment_type == 'delayed and risky (Bayesian Adaptive Design)': from darc.designs import BayesianAdaptiveDesignGeneratorDARC # create an appropriate design object D = DesignSpaceBuilder.delayed_and_risky().build() design_thing = BayesianAdaptiveDesignGeneratorDARC(D, max_trials=expInfo['trials']) # import the appropriate set of models from darc.delayed_and_risky import models # chose the desired model here ============================================ if desired_model is 'Hyperbolic': model = models.Hyperbolic(n_particles=expInfo['particles']) elif desired_model is 'Exponential': model = models.Exponential(n_particles=expInfo['particles']) elif desired_model is 'MyersonHyperboloid': model = models.MyersonHyperboloid(n_particles=expInfo['particles']) elif desired_model is 'ModifiedRachlin': model = models.ModifiedRachlin(n_particles=expInfo['particles']) elif desired_model is 'HyperbolicMagnitudeEffect': model = models.HyperbolicMagnitudeEffect(n_particles=expInfo['particles']) elif desired_model is 'ExponentialMagnitudeEffect': model = models.ExponentialMagnitudeEffect( n_particles=expInfo['particles']) elif desired_model is 'HyperbolicNonLinearUtility': model = models.HyperbolicNonLinearUtility( n_particles=expInfo['particles']) elif desired_model is 'MultiplicativeHyperbolic': model = models.MultiplicativeHyperbolic( n_particles=expInfo['particles']) elif desired_model is 'LinearInLogOdds': model = models.LinearInLogOdds(n_particles=expInfo['particles']) else: logging.error(f'Value of desired_model ({desired_model}) not recognised') raise ValueError('Filed to act on desired_model') return (design_thing, model)