Design for an MMMPlotSuite overall#2405
Conversation
There was a problem hiding this comment.
This looks great! I left some initial comments. IMO Variant A + D in the one I personally like the most. I would love the opinion from others like @cetagostini and @williambdean
My only important commetn: Let's not rely on ArviZ 1.0 yet. This weill need much more work and will be coupled with pymc 6 release (sometime this year I think). Hence, we need to revisit this plan to ensure it has the right ArviZ API.
I would also add that we should aim for certain level of consistency with the interactive plots module :)
| The duplicated axes-normalization code (flatten + wrap in ndarray) appears in at least | ||
| three methods, each with slightly different implementations. | ||
|
|
||
| All of this is already handled by `arviz_plots`' `PlotCollection` API |
There was a problem hiding this comment.
We are still bounded by ArviZ < 1.0
|
|
||
| These correspond to GitHub issues #2369–#2378 and #2388, plus additional findings. | ||
|
|
||
| ### II.1 Return type roulette (GitHub #822, #2369) |
There was a problem hiding this comment.
IMO we should always return (fig , axes) 🙏
There was a problem hiding this comment.
Agree. That was the chosen option in the attack plan https://github.com/pymc-labs/pymc-marketing/blob/isofer/mmmplotsuite-overall/docs/plans/2026-03-11-mmmplotsuite-v2-attack-plan-design.md#return-type
|
|
||
| > **Backward Compatible:** No (changing return types breaks callers; requires deprecation cycle) — **LOE:** L | ||
|
|
||
| ### II.2 Inconsistent `original_scale` default (GitHub #2371) |
There was a problem hiding this comment.
Uhg, I think we should always plot in original scale and get rid of this parameter once and for all.
There was a problem hiding this comment.
I think there is also a value in plotting in the scaled space. So when looking at the idata or using the fundamental plotting functions of PyMC (like plotting traces) they would be in the scaled space. so I think it might be useful to plot in the space where the modeling actually happen.
I wonder what other people think about this. I'll ask in the channel.
|
|
||
|
|
||
| `param_stability` is especially problematic — when `dims` is provided, it creates a | ||
| *separate figure per dimension value* in a for-loop, calling `plt.show()` on each. |
There was a problem hiding this comment.
plt.show() should be removed in the codebase
There was a problem hiding this comment.
|
|
||
| These are issues found during code review that have no corresponding GitHub issue. | ||
|
|
||
| ### IV.1 Copy-paste bugs in `prior_predictive` and its helper |
There was a problem hiding this comment.
Uhg :/ we need to fix these docs indeed
There was a problem hiding this comment.
agree. in the attack plan
| ### IV.7 O(n×m) inner loop in `cv_crps` | ||
|
|
||
| `_pred_matrix_for_rows` (line 4914): Iterates over every row of `rows_df` and does | ||
| `.sel()` per row. For large datasets this is very slow. |
There was a problem hiding this comment.
I think we out typical time series are rather small / medium but not really large
|
|
||
| ## VII. Older / Miscellaneous | ||
|
|
||
| ### VII.1 Coord name `x` → `channel` (GitHub #1183) |
|
|
||
| --- | ||
|
|
||
| ## Comparison Matrix |
There was a problem hiding this comment.
Option Variant: D + A
Approach D can be combined with Approach A by backing each namespace method with a standalone function. This adds a direct function access layer (e.g., from pymc_marketing.mmm.plotting.sensitivity import sensitivity_analysis) for users who prefer working with functions and for easier unit testing. The trade-off is two public API surfaces to maintain. is the one I personally like the mostt:
@juanitorduz raised a concern about using arviz 1.0 for this plan to rewrite MMMPlotSuite. so the plots are done through arviz-plots 1.0, but I still have arviz 0.23.4 (so my idata is still az.InferenceData for example). This seems to be working fine when I tested it. Do you have any concerns with the setup? |
if we can make this work it would be great :) |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e breakdown Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…PR list Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
Design documents for the MMMPlotSuite v2 major-release rewrite. Contains planning docs that lay out the architecture, API contract, and implementation strategy for decomposing the current 5,150-line monolith into a clean namespace-based structure.
Review focus
Please focus on the first 3 sections of the main design doc (
mmmplotsuite-v2-attack-plan-design.md):Files
2026-03-11-mmmplotsuite-v2-attack-plan-design.md-- The main design doc. Covers architectural decisions, target file layout, standardized API contract, helper removal plan, scope split (major vs follow-up), PR sequence, migration guide, and issue traceability.2026-03-10-mmmplotsuite-comprehensive-issues.md-- Audit of the current MMMPlotSuite identifying 45 issues across architecture, API consistency, correctness, performance, and testing.2026-03-10-mmmplotsuite-decomposition-approaches.md-- Analysis of 4 decomposition approaches (flat methods, inheritance, mixins, namespace sub-objects) with trade-offs. Concludes with the namespace sub-objects approach.2026-03-11-figure-customization-design.md-- Deep dive into the figure customization API: how arviz-plots'PlotCollectionintegrates, the 6 standard customization parameters, coverage gaps for bar-plot methods, and thevisuals/aes_by_visualspattern.