pymc
pymc copied to clipboard
Add core notebook demonstrating vectorized/shaped variables (Fixes #4007)
Description
This PR adds a new core notebook vectorized_variables.ipynb under
docs/source/learn/core_notebooks/.
The notebook provides a clear and concise tutorial demonstrating how to work with vectorized and shaped random variables in PyMC. It addresses the request in Issue #4007 by showing:
- How to define RVs with shapes / dims / coords
- How to slice and index vector-valued parameters (e.g.,
mu[data_labels]) - How broadcasting works in PyMC models
- How to model multiple groups simultaneously using vectorized priors
- A small end-to-end example model that mirrors the use case described in #4007
The goal is to give users a direct, accessible reference for one of the most common modeling patterns in PyMC: handling multiple groups with vector-valued parameters.
Related Issue
- Closes #4007
Checklist
- [x] Added new example notebook
- [x] Confirmed the notebook renders correctly in the docs
- [x] Checked pre-commit linting
- [ ] Tests not required for documentation notebooks
Type of change
- [x] Documentation (new example notebook)