Skip to content

Add lightweight self-contained summary report - #314

Closed
uriahf wants to merge 154 commits into
mainfrom
agent/summary-report-d3-poc
Closed

Add lightweight self-contained summary report#314
uriahf wants to merge 154 commits into
mainfrom
agent/summary-report-d3-poc

Conversation

@uriahf

@uriahf uriahf commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Adds a lightweight native Python summary report with visual and functional parity to the R create_summary_report() output.

What this includes

  • Calibration: smooth and discrete curves with marginal prediction histograms
  • Discrimination: ROC, precision-recall, lift, and gains curves
  • Utility: decision curve
  • Performance tables for probability-threshold and PPCR stratification
  • R-style AUROC and prevalence widgets
  • R-style performance-table model filters and threshold/PPCR range controls
  • R-style report navigation, metric cheat sheet, styling, hover behavior, pagination, and expandable confusion matrices
  • Self-contained HTML output with the visualization runtime embedded directly in the report
  • PR documentation preview with a freshly rendered canonical R reference for visual comparison

Implementation

The report uses lightweight HTML/CSS/JavaScript renderers rather than Quarto/Jupyter widget runtimes. Only the small subset of D3-style primitives required by the report is bundled inline, so generated reports do not require a CDN or network connection when viewed.

Validation

  • Python package CI passes on the current head
  • Documentation/preview CI passes on the current head
  • The preview workflow freshly renders both the Python report and canonical R report before deployment
  • Regression coverage verifies that generated reports contain no external script or stylesheet dependencies
  • Visual parity has been checked for calibration, discrimination, utility, AUROC/prevalence widgets, performance-table controls, table styling, and expandable confusion matrices
  • Current preview report size is about 1.08 MB versus about 8.96 MB for the R reference

Preview: https://uriahf.github.io/rtichoke_python/pr-preview/pr-314/summary-report-demo.html

R reference: https://uriahf.github.io/rtichoke_python/pr-preview/pr-314/summary-report-r-reference.html

@uriahf
uriahf marked this pull request as draft August 20, 2026 11:08

uriahf commented Aug 20, 2026

Copy link
Copy Markdown
Owner Author

Conclusion / future direction

After iterating on the R ↔ Python visual comparison, I think this PR is more valuable as an exploratory prototype for a larger cross-language rendering/parity effort than as something we should force into the current create_summary_report() implementation.

What we learned:

  • A lightweight, self-contained HTML report is feasible.
  • We can reproduce much of the R report structure and interaction without changing statistical calculations.
  • However, component-by-component D3 imitation does not naturally converge to close visual parity with the R report. The R report's appearance is strongly determined by the whole R Markdown/Bootstrap + Plotly + Reactable + Crosstalk stack: axes, legends, sliders, spacing, widget sizing, controls, tables, etc.
  • The preview work also showed that parity testing needs Python and R to render the same underlying data; identical RNG seeds across NumPy and R are not sufficient.
  • The existing Python package already has Plotly machinery, so a future implementation could potentially embed Plotly.js once and reuse the package's actual Plotly figures rather than reimplementing their appearance in D3.
  • More broadly, this PR provides a useful concrete prototype for considering a shared R/Python rendering specification or renderer (potentially the larger TypeScript/D3 idea), where both packages consume the same visualization contract instead of independently approximating each other's output.

My recommendation is therefore to keep this PR as a draft/reference rather than merge it as-is. When we tackle full R/Python visualization parity deliberately, we can use #314 as the experimental baseline: preserve the useful renderer/table/control ideas and tests, but design the shared architecture first rather than continuing pixel-by-pixel fixes here.

@uriahf uriahf closed this Aug 20, 2026
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