So I am using an observed data set that N units long. I define my model, define my ObservedRV and give it the training set, and then sample it. Everything appears to work up to that point, the fit parameters of my model look reasonable for the data set I gave it (it is a set we understand well), and then I try to do a posterior predictive sample using it. This is where things start to have problems.
The input set is N units long, (shape (N,))
If I want to get 1 sample from my model, i would expect to use
sample_point = pm.sample(model=model, samples=1, size=1, trace=trace)
but when I do this, I get a strange shape out.
Why is it retaining the shape of the training data?
more detailed code example
train.shape (N,1) train = train.values.reshape(1,len(train)) train.shape (756,) model = pm.Model() with model: sigma=pm.HalfNormal('sigma', 0.1) nu=pm.HalfNormal('nu',1) mu=pm.Normal('mu',0.0) r=pm.StudentT('output', mu=mu, nu=nu, sd=sigma, observed=train) step=pm.NUTS(vars=[r,mu,nu,sigma], gamma=0.25) trace=pm.sample(draws=2000,step=step,tune=500, chains=20, cores=9) post_pred = pm.sample_ppc(model=model, samples=1, size=1, trace=trace) post_pred['output'].shape (1,N)
My expected result is