How to Pull Point Estimates Out of Posterior Check


#1

Hello,

I ran a regression model and then ran a posterior sample check with new input data using the below code.

model_input_train.set_value(np.array(X_test[colnames]))
posterior_samples = pm.sample_ppc(trace, model = model, samples = 1500)

It looks like the result is a dictionary of posterior samples of the y value.

That said, how do I pull the mean of each observation out?
If I wanted to know the probability that the correct prediction is greater that say 1.2, how would I pull that out?


#2

To get the mean you should do
np.mean(posterior_samples['obs_name'], axis=0)

To get the probability that the observed is bigger than 1.2 you should do np.mean(posterior_samples['obs_name'] > 1.2, axis=0)