I am using PYMC to build an fit some GP models to some datasets. I’ve been able to fit conditional GP models through sampling and
find_MAP(); however, when drawing from the posterior, I can’t seem to control the number of posterior samples that are drawn. In the older PYMC GP tutorials a
samples argument could be passed to
sample_posterior_predictive() to control this value, but that has been removed in more recent versions it seems. If I use sampling to fit the covariance function parameters, the the posterior sample count is the same as the MCMC sample count. However, if I use
find_MAP(), I only draw one sample. How can I directly control posterior sample counts?
I’ve included my mode construction below:
with pm.Model() as model: l = pm.Gamma("l", alpha=2, beta=1) eta = pm.HalfCauchy("eta", beta=5) M = pm.gp.mean.Constant(c=1) K = eta**2 * pm.gp.cov.Matern52(1, l) sigma = pm.HalfCauchy("sigma", beta=5) gp = pm.gp.Marginal(mean_func=M, cov_func=K) gp.marginal_likelihood('obs', X=X, y=y, sigma=sigma) # fit = pm.find_MAP() gp_trace = pm.sample(500, tune=500, chains=2) f_pred = gp.conditional("f_pred", X_pred) # gp_samples = pm.sample_posterior_predictive([fit], var_names=["f_pred"]) gp_samples = pm.sample_posterior_predictive(gp_trace, var_names=["f_pred"])
Thanks in advance!