Hey there,
I recently updated to v6, and for a BART model I’ve noticed some interesting shape errors that until now have not been present. My script breaks when I attempt to create posterior predictive samples for my hold out data:
Vectorized input 0 has an incompatible shape in axis 0.
But in my workflow, I am following the suggested pattern in using pm.data to set my matrix of covariates from the test set and a ‘dummy’ vector of predictions:
with self.model: # sample with new input data
pm.set_data({"X": X_test,
"y": .y_test},coords = {"subj":X_test.index})
#pm.set_data({},coords = {"subj".X_test.index})
post_pred = pm.sample_posterior_predictive(trace = self.idata_tree,
model = self.model,
var_names=['Y','θ',],
freeze_vars = ['mu'] ,
# tested with false as well: predictions = True,
progressbar = False,
extend_inferencedata = False,
random_seed = rng
)
My model is a very simple binomial regression with bart serving as a ‘link function’ to the covariates.
with pm.Model(#coords = coords
) as self.model:
#train discrete length intervals on covariates using bart
X_ij = pm.Data('X',
X,
#dims = ("subj", "X_vars")
)
y_obs = pm.Data("y",
y.to_numpy(),
#dims = ("subj")
)
mu = pmb.BART("mu",
X_ij,
y_obs,
**self.model_config,
)
self._BART = mu
θ = pm.Deterministic("θ",
pm.math.sigmoid(mu)
)
Y = pm.Bernoulli("Y",
p = θ,
observed = y_obs,
#dims = 'subj',
)
Is anyone else experiencing something similar?
Thanks!
