Compute posterior predictive of intermediate variable

Suppose I have this situation

def model(Y=None):
      a = numpyro.sample('a', dist.Normal(0,1))
      b = numpyro.sample('b, dist.Normal(0,1))
      f = f(a,b) # f is a generic function
      f2 = f2(f) # f2 is another generic function
      sigma = numpyro.sample('sigma', dist.Normal(0,1))
      numpyro.sample('f2', dist.Normal(f2, sigma), obs=Y)

Once I infer the parameters a,b and sigma I would like to compute the predictive posterior on f. I know that to get the predictive posterior on f2 I can use the class Predict, but how can I do it with f?

see deterministic, something like

f_val = numpyro.deterministic("f_val", f(a, b))

1 Like