Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Horseshoe Prior #836

Merged
merged 19 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from 17 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
11 changes: 10 additions & 1 deletion bambi/backend/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@
import pytensor.tensor as pt
import pymc as pm

MAPPING = {"Cumulative": pm.Categorical, "StoppingRatio": pm.Categorical}

def horseshoe(name, tau_nu=3, lam_nu=1, dims=None):
tau = pm.HalfStudentT(f"{name}_tau", nu=tau_nu)
lam = pm.HalfStudentT(f"{name}_lam", nu=lam_nu, dims=dims)
beta_raw = pm.Normal(f"{name}_raw", 0, 1, dims=dims)
beta = pm.Deterministic(name, beta_raw * tau**2 * lam**2, dims=dims)
return beta
julianlheureux marked this conversation as resolved.
Show resolved Hide resolved


MAPPING = {"Cumulative": pm.Categorical, "StoppingRatio": pm.Categorical, "Horseshoe": horseshoe}


def get_distribution(dist):
Expand Down
Loading
Loading