Hi!
I am new to pyro and having a little difficulty setting up a hierarchical regression model, not sure where I am going wrong. I specified my model as:
def model( x, y, ts, bs ):
w = pyro.sample('w', pyro.distributions.Normal(0,1).expand((9,1)))
b_prior = pyro.sample('b_prior', pyro.distributions.Normal(0,1000))
b_scale = pyro.sample('b_scale', pyro.distributions.HalfCauchy(9))
b = pyro.sample('b', pyro.distributions.Normal(b_prior, b_scale).expand((201,)))
noise_std = pyro.sample('noise_std', pyro.distributions.HalfCauchy(9))
z = torch.matmul(x, w ) * ts + b[bs.long()]
with pyro.plate('data',z.shape[0]):
pyro.sample('obs', pyro.distributions.Normal(z,noise_std), obs=y)'
nuts_kernel = pyro.infer.mcmc.NUTS(model,adapt_step_size=True)
posterior = mcmc.MCMC(nuts_kernel,
num_samples=300,
warmup_steps=200,
num_chains=1).run(x, y, ts, bs )
But when I run I get:
TypeError: model() missing 2 required positional arguments: ‘ts’ and ‘bs’
If I call the model function directly with the same arguments I get the expected output. Appreciate the help!