Hello everyone,
I have the following “toy code” of a more complex problem that I am currently implementing using pymc3 with two gp.Marginal objects in the definition of a single pm.Model(). Are the gp.Marginals considered as independent? i.e. what is the likelihood used for sampling from the posterior in the following example:
data_1 = np.random.rand(10)
data_2 = np.random.rand(5)
x_1 = np.array([i for i in range(10)])[:,None]
x_2 = np.array([i for i in range(5)])[:,None]
with pm.Model() as toy_model:
theta = pm.Gamma("theta", alpha =10, beta= 1)
eta = pm.Gamma("eta", alpha =10, beta= 1)
sigma = pm.InverseGamma("sigma", alpha = 10, beta = 1)
mean_f = pm.gp.mean.Zero()
mean_delat = pm.gp.mean.Zero()
cov_f = pm.gp.cov.ExpQuad(1, ls = theta)
cov_delat = pm.gp.cov.ExpQuad(1, ls = eta)
f = pm.gp.Marginal(mean_func=mean_f, cov_func = cov_f)
delta = pm.gp.Marginal(mean_func=mean_delat, cov_func = cov_delat)
observables = f + delta
y_engine = f.marginal_likelihood("y_engine", X = x_1, y = data_1, noise=sigma)
y_obs = observables.marginal_likelihood("y_obs", X = x_2, y = data_2, noise=sigma)
trace = pm.sample(1000, chains=1)
Are the posteriors being sampled from:
p(\theta, \eta, \sigma| data_1, data_2) \propto p(data_1, data_2| \theta, \eta, \sigma)p(\theta, \eta, \sigma)
with
(data_1, data_2)^T \sim N(0, \Bigg(\begin{matrix} C_1(\theta) & C_{12}(\theta, \eta)\\ C_{21}(\theta, \eta) & C_2(\theta, \eta)\end{matrix}\Bigg))
or
(data_1, data_2)^T \sim N(0, \Bigg(\begin{matrix} C_1(\theta) & 0\\ 0& C_2(\theta, \eta)\end{matrix}\Bigg))
(I dropped the dependency on \sigma for simplicity). I will be grateful for any answers, because I need to make sure that my code uses the first likelihood for the posterior sampling.
Thanks!