Skip to content

Conversation

cetagostini
Copy link
Contributor

@cetagostini cetagostini commented Sep 16, 2025

Description

Introduces the ModelSamplerEstimator utility to estimate computational time of a PyMC models using JAX/NumPyro, including logp/gradient evaluation time and NUTS step counts. The output should be the minimum sample time from their models. Doing so, users could compare the minimum amount of time that their given model will take.

Adds corresponding tests to validate estimator output and schema for simple and multidimensional models.

Example:

est = ModelSamplerEstimator(
    tune=1000, draws=1000, chains=4, sequential_chains=1, seed=1
)
df = est.run(model)

Important

Only working with JAX at the moment.

Related Issue

  • Closes #
  • Related to #

Checklist


📚 Documentation preview 📚: https://pymc-marketing--1943.org.readthedocs.build/en/1943/

Introduces the ModelSamplerEstimator utility to estimate computational characteristics of PyMC models using JAX/NumPyro, including logp/gradient evaluation time and NUTS step counts. Adds corresponding tests to validate estimator output and schema for simple and multidimensional models.
@github-actions github-actions bot added the tests label Sep 16, 2025
@cetagostini cetagostini self-assigned this Sep 16, 2025
@cetagostini cetagostini added enhancement New feature or request MMM model components Related to the various model components labels Sep 16, 2025
@cetagostini
Copy link
Contributor Author

I have a few PRs, I'll add examples in the notebook on another PR :)

Copy link

codecov bot commented Sep 16, 2025

Codecov Report

❌ Patch coverage is 96.72131% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.05%. Comparing base (6b30c10) to head (a53d5c6).

Files with missing lines Patch % Lines
pymc_marketing/pytensor_utils.py 96.72% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1943      +/-   ##
==========================================
+ Coverage   92.01%   92.05%   +0.03%     
==========================================
  Files          67       67              
  Lines        7932     7993      +61     
==========================================
+ Hits         7299     7358      +59     
- Misses        633      635       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cetagostini
Copy link
Contributor Author

@juanitorduz or @williambdean ready for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request MMM model components Related to the various model components tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant