pymc-devs / pymc-examples

Examples of PyMC models, including a library of Jupyter notebooks.
https://www.pymc.io/projects/examples/en/latest/
MIT License
280 stars 243 forks source link

Variational inference/Bayesian neural network: fixed data dims in ann_input/ann_output #506

Closed earlbellinger closed 1 year ago

earlbellinger commented 1 year ago

Fixes issue https://github.com/pymc-devs/pymc-examples/issues/504 using the solution given by OriolAbril, i.e., making the following change:

ann_input = pm.Data("ann_input", X_train, mutable=True, dims=("obs_id", "train_cols"))
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",
)

The notebook now runs to completion.

review-notebook-app[bot] commented 1 year ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB