Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion bauer/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,10 +1076,22 @@ class LapseModel(BaseModel):
lapse_mu_mean = 0.02
lapse_mu_kappa = 8.0
lapse_kappa_sd = 3.0
# ``p_lapse`` mirrors the DDM/RDM ``p_outlier`` API:
# - None (default): the per-subject lapse rate is estimated hierarchically
# (the original behaviour) under ``lapse_group``.
# - a FLOAT: the choice-lapse rate is FIXED at that value; it is NOT a
# sampled parameter, so it cannot funnel/diverge. Useful for hard
# geometries (e.g. full-prior estimation) where a free hierarchical lapse
# trades one funnel for another, and -- as for the RT models' contaminant
# -- where you'd rather assume a small lapse than try to estimate it.
p_lapse = None

def get_free_parameters(self):
pars = super().get_free_parameters()

if isinstance(self.p_lapse, (int, float)):
# Fixed choice-lapse rate: not a free parameter.
return pars
pars['p_lapse'] = _lapse_param_spec(self.lapse_group,
self.lapse_mu_mean,
self.lapse_mu_kappa,
Expand All @@ -1093,7 +1105,10 @@ def _get_choice_predictions(self, model_inputs):

def get_model_inputs(self, parameters):
model_inputs = super().get_model_inputs(parameters)
model_inputs['p_lapse'] = parameters['p_lapse']
if isinstance(self.p_lapse, (int, float)):
model_inputs['p_lapse'] = pt.constant(float(self.p_lapse))
else:
model_inputs['p_lapse'] = parameters['p_lapse']
return model_inputs


Expand Down
Loading