Skip to content

MMM Report#2444

Draft
juanitorduz wants to merge 5 commits into
mainfrom
report
Draft

MMM Report#2444
juanitorduz wants to merge 5 commits into
mainfrom
report

Conversation

@juanitorduz
Copy link
Copy Markdown
Collaborator

@juanitorduz juanitorduz commented Mar 25, 2026

Here is an experimental proposal to generate custom MMM reports with the typical plots and metrics that an analyst/data scientist looks into. We support export as Notebook, HTML, PDF, and Excel. We can also enable custom templates so that analysis can have custom reports. At the moment is very raw so I just want to get some feedback :)


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

@juanitorduz juanitorduz self-assigned this Mar 25, 2026
@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@cursor
Copy link
Copy Markdown
Contributor

cursor Bot commented Mar 25, 2026

PR Summary

Medium Risk
Adds a new report-generation/export pipeline (nbconvert/openpyxl/plotly optional deps) that touches plotting and file export paths; main risk is runtime/environment-specific export failures (PDF engines, Excel writer) and performance on large models.

Overview
Introduces MMMReport, a new high-level API to generate standardized MMM analysis reports and export them to HTML, PDF, and Excel, with an intermediate notebook representation for HTML/PDF rendering.

Adds Pydantic report contracts (ReportConfig, ReportData, ReportSection, ReportMetadata) plus section builders that compute key tables/figures (overview, diagnostics, posterior predictive fit, contributions, ROAS incl. forest plots, saturation curves, optional sensitivity sweep) with configurable HDIs, point estimates, dimension filtering, and optional interactive Plotly outputs.

Extends packaging with a report optional dependency set and template assets, exports MMMReport from pymc_marketing.mmm, and adds targeted tests for config validation, notebook construction, and HTML/Excel export behavior (including Excel sheet-name sanitization).

Written by Cursor Bugbot for commit ed2fe85. This will update automatically on new commits. Configure here.

@juanitorduz juanitorduz marked this pull request as draft March 25, 2026 18:24
@github-actions github-actions Bot added docs Improvements or additions to documentation MMM tests labels Mar 25, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 25, 2026

Codecov Report

❌ Patch coverage is 73.80952% with 110 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.28%. Comparing base (de4a3f8) to head (c79fb9a).

Files with missing lines Patch % Lines
pymc_marketing/mmm/report/_exporters.py 29.03% 66 Missing ⚠️
pymc_marketing/mmm/report/_sections.py 83.43% 27 Missing ⚠️
pymc_marketing/mmm/report/_contracts.py 85.71% 13 Missing ⚠️
pymc_marketing/mmm/report/_report.py 88.46% 3 Missing ⚠️
pymc_marketing/mmm/report/_notebook.py 97.67% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2444      +/-   ##
==========================================
- Coverage   93.86%   93.28%   -0.58%     
==========================================
  Files          90       96       +6     
  Lines       13959    14379     +420     
==========================================
+ Hits        13102    13414     +312     
- Misses        857      965     +108     

☔ 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.

@timbo112711
Copy link
Copy Markdown
Contributor

@juanitorduz I think this is a great start! Like how the main charts / data get reported on all at once. What would be really powerful is to enable the users to provide dates to compare contributions. This is very common within the MMM space, were marketing teams will focus on certain periods of time within the modeling window.

We can take the contribution data and provide YoY comparison views. For example, I'd want to compare Q1 2025 to Q1 2026. Then provide views into:

Thinking this could be an optional arg within MMMReport. When used it produces the chart above along with the existing ones already being displayed.

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

Labels

docs Improvements or additions to documentation MMM tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants