PyMC provides testing utilities to speed up test suites by mocking MCMC sampling with prior predictive sampling. This is useful for checking model structure without running expensive inference.
| Speed | Fast (seconds) | Slow (minutes) | | Use case | Model structure, downstream code | Posterior values, convergence | | Output | prior, priorpredictive | Full posterior, samplestats, warmup groups | | Divergences | Mocked (configurable) | Real diagnostics |
Use mocking when: Testing model specification, CI/CD pipelines, plotting code, API integration, serialization.
pytest로 PyMC 모델 테스트하기 베이지안 모델에 대한 단위 테스트 작성, 테스트 픽스처 설정, MCMC 샘플링 모의 또는 모델 구조 테스트 시 사용합니다. pymc.testing.mock_sample, pytest 픽스처, 빠른 구조 전용 테스트(모의)와 느린 사후 추론 테스트 간의 차이점을 다룹니다. 트리거 대상: PyMC 테스트, pytest, 모델용 단위 테스트, 모의 샘플링, 테스트 설비, 베이지안 모델용 CI/CD. 출처: pymc-labs/python-analytics-skills.