Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
493 changes: 350 additions & 143 deletions examples/howto/LKJ.ipynb

Large diffs are not rendered by default.

32 changes: 20 additions & 12 deletions examples/howto/LKJ.myst.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ outputId: 90631275-86c9-4f4a-f81a-22465d0c8b8c
import arviz as az
import numpy as np
import pymc as pm
import xarray as xr

from matplotlib import pyplot as plt
from matplotlib.lines import Line2D
Expand All @@ -45,7 +46,7 @@ print(f"Running on PyMC v{pm.__version__}")
%config InlineBackend.figure_format = 'retina'
RANDOM_SEED = 8927
rng = np.random.default_rng(RANDOM_SEED)
az.style.use("arviz-darkgrid")
az.style.use("arviz-variat")
```

```{code-cell} ipython3
Expand Down Expand Up @@ -188,6 +189,7 @@ outputId: f039bfb8-1acf-42cb-b054-bc2c97697f96
---
with model:
trace = pm.sample(
nuts_sampler="pymc",
random_seed=rng,
idata_kwargs={"dims": {"chol_stds": ["axis"], "chol_corr": ["axis", "axis_bis"]}},
)
Expand All @@ -208,12 +210,12 @@ colab:
id: dgOKiSLdr2Pi
outputId: a29bde4b-c4dc-49f4-e65d-c3365c1933e1
---
az.plot_trace(
pc = az.plot_dist(
trace,
var_names="chol_corr",
coords={"axis": "y", "axis_bis": "z"},
lines=[("chol_corr", {}, Rho_actual[0, 1])],
);
)
az.add_lines(pc, {"chol_corr": Rho_actual[0, 1]});
```

```{code-cell} ipython3
Expand All @@ -224,16 +226,19 @@ colab:
id: dtBWyd5Jr2Pi
outputId: 94ee6945-a564-487a-e447-3c447057f0bf
---
az.plot_trace(
ref_ds = xr.Dataset(
{
"mu": (("axis",), mu_actual),
"cov": (("axis", "axis_bis"), Sigma_actual),
"chol_stds": (("axis",), sigmas_actual),
},
coords={"axis": ["y", "z"], "axis_bis": ["y", "z"]},
)
pc = az.plot_dist(
trace,
var_names=["~chol", "~chol_corr"],
compact=True,
lines=[
("mu", {}, mu_actual),
("cov", {}, Sigma_actual),
("chol_stds", {}, sigmas_actual),
],
);
)
az.add_lines(pc, ref_ds);
```

+++ {"id": "NnLWJyCMr2Pi"}
Expand Down Expand Up @@ -318,6 +323,9 @@ ax.legend(
);
```

## Authors
- Updated to run on PyMC v6, PyTensor v3, and ArviZ v1 by Chris Fonnesbeck in May 2026

```{code-cell} ipython3
---
colab:
Expand Down
9 changes: 5 additions & 4 deletions pixi.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[project]
[workspace]
authors = ["Chris Fonnesbeck <fonnesbeck@gmail.com>"]
channels = ["conda-forge"]
description = "Add a short description here"
Expand All @@ -10,20 +10,19 @@ version = "0.1.0"

[dependencies]
python = ">=3.13.9,<3.14"
pymc = ">=5.26.1,<6"
pytensor = ">=3.0"
arviz = ">=1.1"
jupyter = ">=1.1.1,<2"
ipykernel = ">=7.1.0,<8"
ipywidgets = ">=8.1.8,<9"
numpy = ">=2.3.5,<3"
arviz = ">=0.22.0,<0.23"
numpyro = ">=0.19.0,<0.20"
seaborn = ">=0.13.2,<0.14"
matplotlib = ">=3.10.8,<4"
pandas = ">=2.3.3,<3"
polars = ">=1.35.2,<2"
esbonio = ">=1.0.0,<2"
watermark = ">=2.5.0,<3"
nutpie = ">=0.16.3,<0.17"
numba = ">=0.62.1,<0.63"
scikit-learn = ">=1.7.2,<2"
blackjax = ">=1.3,<2"
Expand All @@ -32,5 +31,7 @@ bokeh = ">=3.8.1,<4"
plotly = ">=6.5.0,<7"

[pypi-dependencies]
pymc = { git = "https://github.com/pymc-devs/pymc.git", rev = "main" }
nutpie = ">=0.16.9,<0.17"
pymc-extras = ">=0.5.0, <0.6"
kaleido = ">=1.2.0, <2"
Loading