Closed earlbellinger closed 1 year ago
Does it work if you do:
ann_input = pm.Data("ann_input", X_train, mutable=True, dims="obs_id")
ann_output = pm.Data("ann_output", Y_train, mutable=True, dims="obs_id")
...
# Binary classification -> Bernoulli likelihood
out = pm.Bernoulli(
"out",
act_out,
observed=ann_output,
total_size=Y_train.shape[0], # IMPORTANT for minibatches
dims="obs_id",
)
when defining the model?
If not I think the fix will need model.set_dim
.
Thanks for your reply. Unfortunately not; this yields:
ShapeError: Length of `dims` must match the dimensions of the dataset. (actual 1 != expected 2)
oh, sorry, the X are two dimensional, forgot about that. Updated:
ann_input = pm.Data("ann_input", X_train, mutable=True, dims=("obs_id", "train_cols"))
That fixed it! Thanks!
Do you want to rerun the notebook and send a PR to fix the website?
Sure thing, I made one here: https://github.com/pymc-devs/pymc-examples/pull/506
Notebook title: Variational Inference: Bayesian Neural Networks Notebook url: https://github.com/pymc-devs/pymc-examples/blob/main/examples/variational_inference/bayesian_neural_network_advi.ipynb
Issue description
Cell 14:
yields
Expected output