Skip to content

Generalize logp test comparisons to support rtol/atol#8324

Open
ccaprani wants to merge 1 commit into
pymc-devs:mainfrom
ccaprani:test-metric-v6
Open

Generalize logp test comparisons to support rtol/atol#8324
ccaprani wants to merge 1 commit into
pymc-devs:mainfrom
ccaprani:test-metric-v6

Conversation

@ccaprani

@ccaprani ccaprani commented Jun 7, 2026

Copy link
Copy Markdown

Summary

Generalize logp, logcdf, logccdf, icdf test comparisons from assert_almost_equal to assert_allclose with configurable atol and rtol.

Changes

  • Switch from assert_almost_equal to assert_allclose in all check functions
  • Add rtol and atol parameters to all check functions
  • Maintain backward compatibility via decimal parameter (maps to atol = 10**(-decimal), rtol = 1e-10)
  • Use absolute tolerance as primary (MCMC invariant to additive constants per @Armavica)
  • Set n_samples=-1 for deterministic tests (per @ricardoV94)

Defaults

  • atol: 1e-6 (float64), 1e-3 (float32) — primary tolerance
  • rtol: 1e-10 — numerical stability for very large values

Replaces closed #6159.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 pymc | 🛠️ Build #33027636 | 📁 Comparing 69fcbdb against latest (971800b)

  🔍 Preview build  

2 files changed
± glossary.html
± _modules/pymc/testing.html

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.

1 participant