hierarchical-bayesian

Calculating WAIC for models with multiple likelihood functions with pymc3

对着背影说爱祢 提交于 2021-01-29 11:45:01
问题 I try to predict the outcome of soccer games based on the number of goals scored and I use the following model: with pm.Model() as model: # global model parameters h = pm.Normal('h', mu = mu, tau = tau) sd_a = pm.Gamma('sd_a', .1, .1) sd_d = pm.Gamma('sd_d', .1, .1) alpha = pm.Normal('alpha', mu=mu, tau = tau) # team-specific model parameters a_s = pm.Normal("a_s", mu=0, sd=sd_a, shape=n) d_s = pm.Normal("d_s", mu=0, sd=sd_d, shape=n) atts = pm.Deterministic('atts', a_s - tt.mean(a_s)) defs =

Error: non-constant-expression cannot be narrowed from type 'npy_intp' to 'int'

浪子不回头ぞ 提交于 2020-05-10 21:14:13
问题 I am trying to run the following model, but it fails during compilation: import numpy as np import pymc3 as pm def sample_data(G=1, K=2): # mean proportion ([0,1]) for each g p_g = np.random.beta(2, 2, size=G) # concentration around each p_g c_g = np.random.lognormal(mean=0.5, sigma=1, size=G) # reparameterization for standard Beta(a,b) a_g = c_g * p_g / np.sqrt(p_g**2 + (1.-p_g)**2) b_g = c_g*(1.-p_g) / np.sqrt(p_g**2 + (1.-p_g)**2) # for each p_g, sample K proportions p_gk = np.random.beta

Error: non-constant-expression cannot be narrowed from type 'npy_intp' to 'int'

﹥>﹥吖頭↗ 提交于 2020-05-10 21:13:17
问题 I am trying to run the following model, but it fails during compilation: import numpy as np import pymc3 as pm def sample_data(G=1, K=2): # mean proportion ([0,1]) for each g p_g = np.random.beta(2, 2, size=G) # concentration around each p_g c_g = np.random.lognormal(mean=0.5, sigma=1, size=G) # reparameterization for standard Beta(a,b) a_g = c_g * p_g / np.sqrt(p_g**2 + (1.-p_g)**2) b_g = c_g*(1.-p_g) / np.sqrt(p_g**2 + (1.-p_g)**2) # for each p_g, sample K proportions p_gk = np.random.beta

Error: non-constant-expression cannot be narrowed from type 'npy_intp' to 'int'

三世轮回 提交于 2020-05-10 21:12:07
问题 I am trying to run the following model, but it fails during compilation: import numpy as np import pymc3 as pm def sample_data(G=1, K=2): # mean proportion ([0,1]) for each g p_g = np.random.beta(2, 2, size=G) # concentration around each p_g c_g = np.random.lognormal(mean=0.5, sigma=1, size=G) # reparameterization for standard Beta(a,b) a_g = c_g * p_g / np.sqrt(p_g**2 + (1.-p_g)**2) b_g = c_g*(1.-p_g) / np.sqrt(p_g**2 + (1.-p_g)**2) # for each p_g, sample K proportions p_gk = np.random.beta