From 0642746cc765427b0fdb5b56803de65aeb209baa Mon Sep 17 00:00:00 2001 From: Yicheng Yang Date: Sun, 31 May 2026 17:46:11 -0500 Subject: [PATCH] Fix VI quickstart prose that overstated model independence --- examples/variational_inference/variational_api_quickstart.ipynb | 2 +- .../variational_inference/variational_api_quickstart.myst.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/variational_inference/variational_api_quickstart.ipynb b/examples/variational_inference/variational_api_quickstart.ipynb index db9e9ed3b..54428f1ba 100644 --- a/examples/variational_inference/variational_api_quickstart.ipynb +++ b/examples/variational_inference/variational_api_quickstart.ipynb @@ -1465,7 +1465,7 @@ "source": [ "Note: repeated `.eval()` calls on the same `sample_node` produce the same draw because PyTensor's compiled function reads the shared RNG state but does not advance it between calls. To get fresh independent samples, use `sample_node(node, size=N)`, which materializes N draws within a single graph evaluation.\n", "\n", - "By applying replacements, we are now free of the dependence on the PyMC model; instead, we now depend on the approximation. Changing it will change the distribution for stochastic nodes:" + "By applying replacements, `sample_node` swaps the model's random variables for draws from the approximation. The expression still builds on the model, but its randomness now comes from the approximation, so changing the approximation changes the distribution of the stochastic nodes." ] }, { diff --git a/examples/variational_inference/variational_api_quickstart.myst.md b/examples/variational_inference/variational_api_quickstart.myst.md index 33420dc71..6538bdbb9 100644 --- a/examples/variational_inference/variational_api_quickstart.myst.md +++ b/examples/variational_inference/variational_api_quickstart.myst.md @@ -351,7 +351,7 @@ a_sample.eval() Note: repeated `.eval()` calls on the same `sample_node` produce the same draw because PyTensor's compiled function reads the shared RNG state but does not advance it between calls. To get fresh independent samples, use `sample_node(node, size=N)`, which materializes N draws within a single graph evaluation. -By applying replacements, we are now free of the dependence on the PyMC model; instead, we now depend on the approximation. Changing it will change the distribution for stochastic nodes: +By applying replacements, `sample_node` swaps the model's random variables for draws from the approximation. The expression still builds on the model, but its randomness now comes from the approximation, so changing the approximation changes the distribution of the stochastic nodes. ```{code-cell} ipython3 a_dataset = az.convert_to_dataset({"a": svgd_approx.sample_node(a, size=2000).eval()[None, :]})