Skip to content

Instantly share code, notes, and snippets.

@petrushev
Created May 28, 2020 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petrushev/fa0cc0ac65590fee874e541b5fdc3f84 to your computer and use it in GitHub Desktop.
Save petrushev/fa0cc0ac65590fee874e541b5fdc3f84 to your computer and use it in GitHub Desktop.
with pm.Model() as m:
pi = data.partner_id.astype('category').cat.codes.values
ii = data.item_id.astype('category').cat.codes.values
# [rest of priors here]
item_sigma = pm.Exponential('item_sigma', 1)
b_item = pm.Normal('b_item', 0, item_sigma, shape=ii.nunique())
p = pm.math.invlogit(
a
+ ..
+ b_item[ii]
)
pm.Binomial('obs', p=p, n=data.observations.values, observed=data.successes.values)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment