From 201cdb9f84a4f4afba29dc01041941d211a85d65 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 17 Sep 2026 07:45:41 +0000 Subject: [PATCH] Align time-dependent summary report presentation - Rename Event Risk section/component titles to Event Probability - Rename ReportSpec title to Summary Report - Reorder Discrimination components to ROC -> Lift -> Precision-Recall -> Gains - Update corresponding test assertions - Preserve all internal IDs, metrics, and statistical producers Co-authored-by: uriahf <11351434+uriahf@users.noreply.github.com> --- src/rtichoke/_summary_metrics_spec.py | 2 +- src/rtichoke/summary_report/summary_report.py | 10 ++++---- tests/test_summary_metrics_spec.py | 2 +- tests/test_summary_report_times_browser.py | 25 ++++++++++++------- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/rtichoke/_summary_metrics_spec.py b/src/rtichoke/_summary_metrics_spec.py index d130b04d..33e36f53 100644 --- a/src/rtichoke/_summary_metrics_spec.py +++ b/src/rtichoke/_summary_metrics_spec.py @@ -266,7 +266,7 @@ def _event_risk_summary_metrics_spec( return { "schemaVersion": "1.1", "type": "summary_metrics", - "title": "Event Risk", + "title": "Event Probability", "evaluations": [], "populations": populations_list, "metrics": metrics_list, diff --git a/src/rtichoke/summary_report/summary_report.py b/src/rtichoke/summary_report/summary_report.py index da980cc7..3a303ea3 100644 --- a/src/rtichoke/summary_report/summary_report.py +++ b/src/rtichoke/summary_report/summary_report.py @@ -200,11 +200,11 @@ def create_summary_report_times( sections = [ { "id": "event-risk", - "title": "Event Risk", + "title": "Event Probability", "components": [ { "id": "event-risk", - "title": "Event Risk", + "title": "Event Probability", "spec": event_risk_spec, } ], @@ -234,6 +234,7 @@ def create_summary_report_times( "title": "By Probability Threshold", "components": [ {"id": "roc", "title": "ROC", "spec": roc_thresh_spec}, + {"id": "lift", "title": "Lift", "spec": lift_thresh_spec}, { "id": "precision-recall", "title": "Precision-Recall", @@ -244,7 +245,6 @@ def create_summary_report_times( "title": "Gains", "spec": gains_thresh_spec, }, - {"id": "lift", "title": "Lift", "spec": lift_thresh_spec}, ], }, { @@ -252,6 +252,7 @@ def create_summary_report_times( "title": "By Predicted Positives Condition Rate (PPCR)", "components": [ {"id": "roc-2", "title": "ROC", "spec": roc_ppcr_spec}, + {"id": "lift-2", "title": "Lift", "spec": lift_ppcr_spec}, { "id": "precision-recall-2", "title": "Precision-Recall", @@ -262,7 +263,6 @@ def create_summary_report_times( "title": "Gains", "spec": gains_ppcr_spec, }, - {"id": "lift-2", "title": "Lift", "spec": lift_ppcr_spec}, ], }, ], @@ -313,7 +313,7 @@ def create_summary_report_times( }, ] - report = _build_report_spec_v11(sections, title="rtichoke summary report") + report = _build_report_spec_v11(sections, title="Summary Report") return RtichokeBrowserReport(cast(dict[str, Any], report)).write_html(output_file) diff --git a/tests/test_summary_metrics_spec.py b/tests/test_summary_metrics_spec.py index 6d36c51c..d739a23e 100644 --- a/tests/test_summary_metrics_spec.py +++ b/tests/test_summary_metrics_spec.py @@ -144,7 +144,7 @@ def test_event_risk_summary_metrics_spec_multiple_models_shared_population(): spec = _event_risk_summary_metrics_spec(perf_data, metadata, horizons) assert spec["schemaVersion"] == "1.1" assert spec["type"] == "summary_metrics" - assert spec["title"] == "Event Risk" + assert spec["title"] == "Event Probability" assert spec["evaluations"] == [] assert len(spec["populations"]) == 1 assert spec["populations"][0]["id"] == "population-1" diff --git a/tests/test_summary_report_times_browser.py b/tests/test_summary_report_times_browser.py index bae530e8..b4218478 100644 --- a/tests/test_summary_report_times_browser.py +++ b/tests/test_summary_report_times_browser.py @@ -139,6 +139,7 @@ def test_summary_report_times_spec_structure_and_ordering(tmp_path): report = _embedded_report(output.read_text(encoding="utf-8")) assert report["schemaVersion"] == "1.1" assert report["type"] == "report" + assert report["title"] == "Summary Report" # Exact section hierarchy sections = report["sections"] @@ -153,23 +154,28 @@ def test_summary_report_times_spec_structure_and_ordering(tmp_path): # Section titles assert [s["title"] for s in sections] == [ - "Event Risk", + "Event Probability", "Calibration", "Discrimination", "Utility", "Performance Table", ] - # Event Risk section checks + # Event Probability section checks event_risk_sec = sections[0] + assert event_risk_sec["id"] == "event-risk" + assert event_risk_sec["title"] == "Event Probability" assert [c["id"] for c in event_risk_sec["items"]] == ["event-risk"] + assert event_risk_sec["items"][0]["title"] == "Event Probability" assert event_risk_sec["items"][0]["spec"]["schemaVersion"] == "1.1" assert event_risk_sec["items"][0]["spec"]["type"] == "summary_metrics" + assert event_risk_sec["items"][0]["spec"]["title"] == "Event Probability" assert event_risk_sec["items"][0]["spec"]["metrics"][0]["metric"] == "event_risk" # Explicit omissions check assert "prevalence" not in section_ids assert "auroc" not in json.dumps(report) + assert "prediction-distribution" not in section_ids # Calibration section components calib = sections[1] @@ -185,30 +191,30 @@ def test_summary_report_times_spec_structure_and_ordering(tmp_path): assert g1["title"] == "By Probability Threshold" assert [c["id"] for c in g1["components"]] == [ "roc", + "lift", "precision-recall", "gains", - "lift", ] assert [c["title"] for c in g1["components"]] == [ "ROC", + "Lift", "Precision-Recall", "Gains", - "Lift", ] assert g2["id"] == "discrimination-ppcr" assert g2["title"] == "By Predicted Positives Condition Rate (PPCR)" assert [c["id"] for c in g2["components"]] == [ "roc-2", + "lift-2", "precision-recall-2", "gains-2", - "lift-2", ] assert [c["title"] for c in g2["components"]] == [ "ROC", + "Lift", "Precision-Recall", "Gains", - "Lift", ] # Utility section components @@ -311,12 +317,13 @@ def test_summary_report_times_preserves_standalone_canonical_producers(tmp_path) report_event_risk = report["sections"][0]["items"][0]["spec"] assert report_event_risk["schemaVersion"] == "1.1" + assert report_event_risk["title"] == "Event Probability" report_calib_smooth = report["sections"][1]["items"][0]["spec"] report_roc_thresh = report["sections"][2]["items"][0]["components"][0]["spec"] - report_pr_thresh = report["sections"][2]["items"][0]["components"][1]["spec"] + report_lift_thresh = report["sections"][2]["items"][0]["components"][1]["spec"] + report_pr_thresh = report["sections"][2]["items"][0]["components"][2]["spec"] report_roc_ppcr = report["sections"][2]["items"][1]["components"][0]["spec"] - report_gains_ppcr = report["sections"][2]["items"][1]["components"][2]["spec"] - report_lift_thresh = report["sections"][2]["items"][0]["components"][3]["spec"] + report_gains_ppcr = report["sections"][2]["items"][1]["components"][3]["spec"] report_dc = report["sections"][3]["items"][0]["spec"] report_ia = report["sections"][3]["items"][1]["spec"] report_table_thresh = report["sections"][4]["items"][0]["components"][0]["spec"]