Using sample posterior predictive on new data

Hi @Alexander_Grunewald,

I believe the mismatch is on your target variable y. You can either pass in zeros of the new shape into pm.set_data() (These aren’t used in the computation of your posterior predictive)

pm.set_data({
        "rugged_std": rugged_seq,
        "continent_indx": continent_pred,
        "y": np.zeros_like(rugged_seq)
    }, coords = {"obs_id": np.arange(rugged_seq.shape[0])})

or you can pass the argument predictions=True into pm.sample_posterior_predictive():

mu_pred = pm.sample_posterior_predictive(idata3, var_names=["mu"], predictions=True)
1 Like