docs(sample_smc): describe the start parameter format#8310
Open
adv0r wants to merge 1 commit into
Open
Conversation
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>
Documentation build overview
3 files changed± glossary.html± api/generated/pymc.smc.sample_smc.html± _modules/pymc/smc/sampling.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #7283.
The
startargument ofpymc.sample_smcworks differently fromstartinpymc.sample, but the docstring did not actually explain how — it only said it is "a list of dict with lengthchains". The issue asked specifically for a clear description of the dict format.What this PR does
Rewrites the
startentry in thesample_smcdocstring to spell out:drawsparticles, not a single point per chain.None,dict, sequence ofdict) and the validation rule that the sequence length must equalchains.model.rvs_to_values[rv].name), and each value is an array of shape(draws, *var.shape)where rowiis particlei.pm.HalfNormal(\"sigma\")becomes\"sigma_log__\"), so starting values for such variables are expected on the unconstrained scale.Normal/HalfNormalmodel.I tried to keep the example minimal so it stays in sync with the actual contract used by
_initialize_kernelinpymc/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
Made with Cursor