Skip to content

Add expected model size controls for spike-and-slab priors - #1191

Open
leninworld wants to merge 1 commit into
pymc-labs:mainfrom
leninworld:feat-expected-model-size-issue-1177
Open

leninworld wants to merge 1 commit into
pymc-labs:mainfrom
leninworld:feat-expected-model-size-issue-1177

Conversation

@leninworld

@leninworld leninworld commented Sep 19, 2026 •

Copy link
Copy Markdown

This PR fixes issue #1177.

Summary

  • add expected_num_nonzero and pi_concentration as an explicit convenience pair for spike-and-slab priors
  • derive the Beta inclusion-probability shapes from expected model size while preserving existing pi_alpha/pi_beta behavior
  • validate incomplete, conflicting, non-finite, and out-of-range configurations
  • cover instance-level, call-level, split-precedence, and InstrumentalVariable integration paths

Closes #1177.

Validation

  • focused variable-selection and instrumental-variable tests — 47 passed
  • commit hooks: licensing, Ruff lint/format, codespell, numpydoc, mypy, and repository checks — passed
  • broad suite — 1,249 passed, 5 skipped; 4 failures and 10 errors are isolated to unrelated PyMC time-series validators under Python 3.14
  • doctest run — 36 passed before an unrelated Python 3.14/PyMC multiprocessing segfault in panel regression

Validation evidence

CausalPy Stage 3 validation

Compatibility and scope

Existing defaults remain pi_alpha=2 and pi_beta=2. The convenience parameters are optional, must be supplied together, and cannot be mixed with explicit Beta shape parameters. The expected size controls the prior inclusion probability, not a hard selected-variable count or posterior guarantee.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Welcome to CausalPy, @leninworld!

Thank you for opening your first pull request! We're excited to have you contribute to the project. 🎉

Here are a few tips to help your PR get merged smoothly:

  • ✅ Make sure all CI checks pass (tests, linting, type checking)
  • 📝 Run prek run --all-files locally before pushing
  • 📖 Check our Contributing Guide for more details

A maintainer will review your changes soon. Thanks for helping make CausalPy better! 🚀


💼 LinkedIn Shoutout: Once your PR is merged, we'd love to give you a shoutout on LinkedIn to thank you for your contribution! If you're interested, just drop your LinkedIn profile URL in a comment below.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spike_and_slab defaults lack an expected-model-size control

1 participant