Skip to content

Commit

Permalink
Adjust the order in which ensure_positive_ndt is applied
Browse files Browse the repository at this point in the history
  • Loading branch information
digicosmos86 committed Jun 4, 2024
1 parent a135502 commit 42f02a1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/hssm/distribution_utils/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,22 +452,26 @@ def logp(data, *dist_params): # pylint: disable=E0213
lapse_logp = lapse_func(data[:, 0].eval())
# AF-TODO potentially apply clipping here
logp = loglik(data, *dist_params, *extra_fields)
# Ensure that non-decision time is always smaller than rt.
# Assuming that the non-decision time parameter is always named "t".
logp = ensure_positive_ndt(data, logp, list_params, dist_params)
logp = pt.log(
(1.0 - p_outlier) * pt.exp(logp)
+ p_outlier * pt.exp(lapse_logp)
+ 1e-29
)
else:
logp = loglik(data, *dist_params, *extra_fields)
# Ensure that non-decision time is always smaller than rt.
# Assuming that the non-decision time parameter is always named "t".
logp = ensure_positive_ndt(data, logp, list_params, dist_params)

if bounds is not None:
logp = apply_param_bounds_to_loglik(
logp, list_params, *dist_params, bounds=bounds
)

# Ensure that non-decision time is always smaller than rt.
# Assuming that the non-decision time parameter is always named "t".
return ensure_positive_ndt(data, logp, list_params, dist_params)
return logp

return SSMDistribution

Expand Down

0 comments on commit 42f02a1

Please sign in to comment.