Skip to content

docs(sample_smc): describe the start parameter format#8310

Open
adv0r wants to merge 1 commit into
pymc-devs:mainfrom
adv0r:tokenburn/pymc-7283-sample-smc-start
Open

docs(sample_smc): describe the start parameter format#8310
adv0r wants to merge 1 commit into
pymc-devs:mainfrom
adv0r:tokenburn/pymc-7283-sample-smc-start

Conversation

@adv0r
Copy link
Copy Markdown

@adv0r adv0r commented May 20, 2026

Description

Closes #7283.

The start argument of pymc.sample_smc works differently from start in pymc.sample, but the docstring did not actually explain how — it only said it is "a list of dict with length chains". The issue asked specifically for a clear description of the dict format.

What this PR does

Rewrites the start entry in the sample_smc docstring to spell out:

  • That for SMC each "start" is a starting population of draws particles, not a single point per chain.
  • The three accepted forms (None, dict, sequence of dict) and the validation rule that the sequence length must equal chains.
  • The dict shape: keys are the value-variable names of the model's free RVs (i.e. model.rvs_to_values[rv].name), and each value is an array of shape (draws, *var.shape) where row i is particle i.
  • The transform subtlety: automatic transforms are reflected in the value-variable names (pm.HalfNormal(\"sigma\") becomes \"sigma_log__\"), so starting values for such variables are expected on the unconstrained scale.
  • A short, self-contained example for a Normal/HalfNormal model.

I tried to keep the example minimal so it stays in sync with the actual contract used by _initialize_kernel in pymc/smc/kernels.py.

What this PR does not do

No code or behavioral change — docstring-only edit on pymc.sample_smc. If maintainers prefer a different format (e.g. a dedicated subsection in the SMC docs or a User Guide page), happy to move the content.

Related Issue(s)

Closes #7283

Checklist

  • Checked that the pre-commit linting/style checks pass.
  • Included tests that prove the fix is effective or that the new feature works. (N/A — docs-only.)
  • Added necessary documentation (docstrings and/or example notebooks).

Authored and verified by an AI agent (Claude Opus 4.7 via Cursor) operating unattended as a personal token-burn initiative by @adv0r. Not human-reviewed before submission. Please double-check the value-variable / transform claims against the current SMC code path; that's the most error-prone part of the doc.

Made with Cursor

Closes pymc-devs#7283.

Clarifies that for sample_smc the `start` argument is a starting
*population* (one particle per draw), not a single starting point as
in pm.sample, and shows the expected dict shape and key names.

Specifically:

- distinguishes the three accepted forms (None, dict, sequence of dict)
  and notes that the sequence length must equal `chains`;
- documents that each dict maps the model's free-RV *value-variable*
  names to arrays of shape (draws, *var.shape), and that automatic
  transforms (e.g. log for HalfNormal) are reflected in the value-var
  names;
- adds a self-contained example that sets a custom starting population
  for a Normal/HalfNormal model.

No code or behavioral change.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added the docs label May 20, 2026
@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 pymc | 🛠️ Build #32774909 | 📁 Comparing 76993e2 against latest (853149c)

  🔍 Preview build  

3 files changed
± glossary.html
± api/generated/pymc.smc.sample_smc.html
± _modules/pymc/smc/sampling.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOC: format of the initial values for the sample_smc function

1 participant