Skip to content

Add maketables plugin MVP for core experiments#773

Merged
drbenvincent merged 9 commits intomainfrom
issue-600-maketables-mvp
Apr 2, 2026
Merged

Add maketables plugin MVP for core experiments#773
drbenvincent merged 9 commits intomainfrom
issue-600-maketables-mvp

Conversation

@drbenvincent
Copy link
Copy Markdown
Collaborator

Summary

  • Add adapter-based optional maketables integration on BaseExperiment via __maketables_* hooks, without adding maketables as a core dependency.
  • Implement backend-specific extraction in a new internal adapter module, including configurable PyMC HDI interval levels and explicit multi-treated-unit ambiguity errors.
  • Add targeted plugin tests and wire ETable(...) examples plus explanatory markdown into core DiD/ITS/SC/RD notebooks (PyMC and sklearn), using backend-appropriate table formatting.

Fixes #600

Test plan

  • $CONDA_EXE run -n CausalPy python -m pytest --no-cov causalpy/tests/test_maketables_plugin.py
  • $CONDA_EXE run -n CausalPy pre-commit run --all-files
  • Manually validated notebook ETable(...) rendering behavior for PyMC and sklearn examples
  • Expand automated coverage for additional experiment types in follow-up PR(s)

Notes

  • This is an initial MVP PR. Coverage currently targets core plugin behavior and representative experiment families; full experiment-type coverage is intentionally deferred to follow-up work.

Made with Cursor

@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

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented Mar 1, 2026

Documentation build overview

📚 causalpy | 🛠️ Build #32078468 | 📁 Comparing 2e7d4af against latest (55256f5)

  🔍 Preview build  

Show files changed (49 files in total): 📝 38 modified | ➕ 11 added | ➖ 0 deleted
File Status
404.html 📝 modified
genindex.html 📝 modified
notebooks/ancova_pymc.html 📝 modified
notebooks/did_pymc.html 📝 modified
notebooks/did_pymc_banks.html 📝 modified
notebooks/did_skl.html 📝 modified
notebooks/geolift1.html 📝 modified
notebooks/inv_prop_latent.html 📝 modified
notebooks/inv_prop_pymc.html 📝 modified
notebooks/its_covid.html 📝 modified
notebooks/its_lift_test.html 📝 modified
notebooks/its_post_intervention_analysis.html 📝 modified
notebooks/its_pymc.html 📝 modified
notebooks/its_pymc_comparative.html 📝 modified
notebooks/its_skl.html 📝 modified
notebooks/multi_cell_geolift.html 📝 modified
notebooks/piecewise_its_pymc.html 📝 modified
notebooks/rd_donut_pymc.html 📝 modified
notebooks/rd_pymc.html 📝 modified
notebooks/rd_pymc_drinking.html 📝 modified
notebooks/rd_skl.html 📝 modified
notebooks/rd_skl_drinking.html 📝 modified
notebooks/sc_pymc.html 📝 modified
notebooks/sc_pymc_brexit.html 📝 modified
notebooks/sc_skl.html 📝 modified
notebooks/staggered_did_pymc.html 📝 modified
api/generated/causalpy.experiments.base.BaseExperiment.html 📝 modified
api/generated/causalpy.experiments.base.BaseExperiment.set_maketables_options.html ➕ added
api/generated/causalpy.experiments.diff_in_diff.DifferenceInDifferences.html 📝 modified
api/generated/causalpy.experiments.diff_in_diff.DifferenceInDifferences.set_maketables_options.html ➕ added
api/generated/causalpy.experiments.instrumental_variable.InstrumentalVariable.html 📝 modified
api/generated/causalpy.experiments.instrumental_variable.InstrumentalVariable.set_maketables_options.html ➕ added
api/generated/causalpy.experiments.interrupted_time_series.InterruptedTimeSeries.html 📝 modified
api/generated/causalpy.experiments.interrupted_time_series.InterruptedTimeSeries.set_maketables_options.html ➕ added
api/generated/causalpy.experiments.inverse_propensity_weighting.InversePropensityWeighting.html 📝 modified
api/generated/causalpy.experiments.inverse_propensity_weighting.InversePropensityWeighting.set_maketables_options.html ➕ added
api/generated/causalpy.experiments.piecewise_its.PiecewiseITS.html 📝 modified
api/generated/causalpy.experiments.piecewise_its.PiecewiseITS.set_maketables_options.html ➕ added
api/generated/causalpy.experiments.prepostnegd.PrePostNEGD.html 📝 modified
api/generated/causalpy.experiments.prepostnegd.PrePostNEGD.set_maketables_options.html ➕ added
api/generated/causalpy.experiments.regression_discontinuity.RegressionDiscontinuity.html 📝 modified
api/generated/causalpy.experiments.regression_discontinuity.RegressionDiscontinuity.set_maketables_options.html ➕ added
api/generated/causalpy.experiments.regression_kink.RegressionKink.html 📝 modified
api/generated/causalpy.experiments.regression_kink.RegressionKink.set_maketables_options.html ➕ added
api/generated/causalpy.experiments.staggered_did.StaggeredDifferenceInDifferences.html 📝 modified
api/generated/causalpy.experiments.staggered_did.StaggeredDifferenceInDifferences.set_maketables_options.html ➕ added
api/generated/causalpy.experiments.synthetic_control.SyntheticControl.html 📝 modified
api/generated/causalpy.experiments.synthetic_control.SyntheticControl.set_maketables_options.html ➕ added
_modules/causalpy/experiments/base.html 📝 modified

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 1, 2026

Codecov Report

❌ Patch coverage is 99.17898% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.77%. Comparing base (eec45f7) to head (2e7d4af).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
causalpy/maketables_adapters.py 97.48% 2 Missing and 2 partials ⚠️
causalpy/experiments/base.py 96.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #773      +/-   ##
==========================================
+ Coverage   93.48%   93.77%   +0.29%     
==========================================
  Files          75       77       +2     
  Lines       11272    11881     +609     
  Branches      658      696      +38     
==========================================
+ Hits        10538    11142     +604     
- Misses        544      546       +2     
- Partials      190      193       +3     

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

@drbenvincent drbenvincent marked this pull request as draft March 1, 2026 09:51
@drbenvincent drbenvincent marked this pull request as ready for review March 11, 2026 17:11
@drbenvincent
Copy link
Copy Markdown
Collaborator Author

Could I get a review on this @juanitorduz? Because this updates many notebooks I'm keen to merge it soon to avoid building up notebook conflicts. Very open to change requests, but it's intended as a foot in the door PR to get maketables integrated in to causalpy. We can build from here.

Currently getting this to green, in terms of codecov

@drbenvincent drbenvincent force-pushed the issue-600-maketables-mvp branch from 99f9214 to 8386847 Compare March 11, 2026 17:20
…600)

Introduce adapter-based __maketables_* support on BaseExperiment with targeted tests and configurable PyMC HDI intervals, then wire maketables tables into DiD/ITS/SC/RD docs notebooks with backend-appropriate formatting and guidance.

Made-with: Cursor
Add maketables adapter/test coverage for additional experiments and backend-specific posterior coefficient shapes. Update affected docs notebooks with simple ETable examples, including side-by-side model comparisons where multiple fitted results are present.

Made-with: Cursor
Add targeted unit tests for internal adapter helpers and edge cases
that were uncovered in the codecov/patch report (62% → expected ~95%).
Covers _safe_observation_count, _safe_r2_value, _canonical_frame,
_extract_hdi_bounds, _get_maketables_hdi_prob, get_maketables_adapter,
and SklearnMaketablesAdapter error paths. Adds integration test for
PyMCMaketablesAdapter stat/metadata methods.

Made-with: Cursor
Resolve merge conflicts from PR #749 in staggered_did_pymc.ipynb
(re-add ETable cells and fix nbformat output metadata/name fields).
Drop rkink_pymc.ipynb output-only changes in favor of main's version.
Add docstrings to adapter methods to satisfy interrogate threshold.

Made-with: Cursor
@drbenvincent drbenvincent force-pushed the issue-600-maketables-mvp branch from 8386847 to a9533d5 Compare March 11, 2026 17:58
Use the named-dimension geometric adstock call only when the installed pymc-marketing version requires it, and repair stale notebook output metadata so schema validation passes again.

Made-with: Cursor
Keep the named-dimension notebook path xtensor-native through logistic_saturation so the lift test example runs on newer pymc-marketing releases while preserving the legacy code path.

Made-with: Cursor
Resolve the notebook conflict in its_lift_test by keeping the PR notebook content, which already included the main-branch compatibility fix plus the PR's extra maketables cells.

Made-with: Cursor
@drbenvincent
Copy link
Copy Markdown
Collaborator Author

I'm going to be a bit risky here and bypass rules requiring review. We have many docs pages touched in this PR and this is a dangerous state to be in because there is very high potential for notebook conflicts to occur in other PR's. So I'm going to merge this and deal with any fallout later. This is probably the minimal-paid path

@drbenvincent drbenvincent merged commit 7db0672 into main Apr 2, 2026
15 checks passed
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