Skip to content

Commit c81dddc

Browse files
authored
Merge pull request #423 from uriahf/jules-2771749969521054353-47db0217
Align time-dependent summary report presentation and terminology
2 parents 3db8081 + 201cdb9 commit c81dddc

4 files changed

Lines changed: 23 additions & 16 deletions

File tree

‎src/rtichoke/_summary_metrics_spec.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def _event_risk_summary_metrics_spec(
266266
return {
267267
"schemaVersion": "1.1",
268268
"type": "summary_metrics",
269-
"title": "Event Risk",
269+
"title": "Event Probability",
270270
"evaluations": [],
271271
"populations": populations_list,
272272
"metrics": metrics_list,

‎src/rtichoke/summary_report/summary_report.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ def create_summary_report_times(
200200
sections = [
201201
{
202202
"id": "event-risk",
203-
"title": "Event Risk",
203+
"title": "Event Probability",
204204
"components": [
205205
{
206206
"id": "event-risk",
207-
"title": "Event Risk",
207+
"title": "Event Probability",
208208
"spec": event_risk_spec,
209209
}
210210
],
@@ -234,6 +234,7 @@ def create_summary_report_times(
234234
"title": "By Probability Threshold",
235235
"components": [
236236
{"id": "roc", "title": "ROC", "spec": roc_thresh_spec},
237+
{"id": "lift", "title": "Lift", "spec": lift_thresh_spec},
237238
{
238239
"id": "precision-recall",
239240
"title": "Precision-Recall",
@@ -244,14 +245,14 @@ def create_summary_report_times(
244245
"title": "Gains",
245246
"spec": gains_thresh_spec,
246247
},
247-
{"id": "lift", "title": "Lift", "spec": lift_thresh_spec},
248248
],
249249
},
250250
{
251251
"id": "discrimination-ppcr",
252252
"title": "By Predicted Positives Condition Rate (PPCR)",
253253
"components": [
254254
{"id": "roc-2", "title": "ROC", "spec": roc_ppcr_spec},
255+
{"id": "lift-2", "title": "Lift", "spec": lift_ppcr_spec},
255256
{
256257
"id": "precision-recall-2",
257258
"title": "Precision-Recall",
@@ -262,7 +263,6 @@ def create_summary_report_times(
262263
"title": "Gains",
263264
"spec": gains_ppcr_spec,
264265
},
265-
{"id": "lift-2", "title": "Lift", "spec": lift_ppcr_spec},
266266
],
267267
},
268268
],
@@ -313,7 +313,7 @@ def create_summary_report_times(
313313
},
314314
]
315315

316-
report = _build_report_spec_v11(sections, title="rtichoke summary report")
316+
report = _build_report_spec_v11(sections, title="Summary Report")
317317
return RtichokeBrowserReport(cast(dict[str, Any], report)).write_html(output_file)
318318

319319

‎tests/test_summary_metrics_spec.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def test_event_risk_summary_metrics_spec_multiple_models_shared_population():
144144
spec = _event_risk_summary_metrics_spec(perf_data, metadata, horizons)
145145
assert spec["schemaVersion"] == "1.1"
146146
assert spec["type"] == "summary_metrics"
147-
assert spec["title"] == "Event Risk"
147+
assert spec["title"] == "Event Probability"
148148
assert spec["evaluations"] == []
149149
assert len(spec["populations"]) == 1
150150
assert spec["populations"][0]["id"] == "population-1"

‎tests/test_summary_report_times_browser.py‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def test_summary_report_times_spec_structure_and_ordering(tmp_path):
139139
report = _embedded_report(output.read_text(encoding="utf-8"))
140140
assert report["schemaVersion"] == "1.1"
141141
assert report["type"] == "report"
142+
assert report["title"] == "Summary Report"
142143

143144
# Exact section hierarchy
144145
sections = report["sections"]
@@ -153,23 +154,28 @@ def test_summary_report_times_spec_structure_and_ordering(tmp_path):
153154

154155
# Section titles
155156
assert [s["title"] for s in sections] == [
156-
"Event Risk",
157+
"Event Probability",
157158
"Calibration",
158159
"Discrimination",
159160
"Utility",
160161
"Performance Table",
161162
]
162163

163-
# Event Risk section checks
164+
# Event Probability section checks
164165
event_risk_sec = sections[0]
166+
assert event_risk_sec["id"] == "event-risk"
167+
assert event_risk_sec["title"] == "Event Probability"
165168
assert [c["id"] for c in event_risk_sec["items"]] == ["event-risk"]
169+
assert event_risk_sec["items"][0]["title"] == "Event Probability"
166170
assert event_risk_sec["items"][0]["spec"]["schemaVersion"] == "1.1"
167171
assert event_risk_sec["items"][0]["spec"]["type"] == "summary_metrics"
172+
assert event_risk_sec["items"][0]["spec"]["title"] == "Event Probability"
168173
assert event_risk_sec["items"][0]["spec"]["metrics"][0]["metric"] == "event_risk"
169174

170175
# Explicit omissions check
171176
assert "prevalence" not in section_ids
172177
assert "auroc" not in json.dumps(report)
178+
assert "prediction-distribution" not in section_ids
173179

174180
# Calibration section components
175181
calib = sections[1]
@@ -185,30 +191,30 @@ def test_summary_report_times_spec_structure_and_ordering(tmp_path):
185191
assert g1["title"] == "By Probability Threshold"
186192
assert [c["id"] for c in g1["components"]] == [
187193
"roc",
194+
"lift",
188195
"precision-recall",
189196
"gains",
190-
"lift",
191197
]
192198
assert [c["title"] for c in g1["components"]] == [
193199
"ROC",
200+
"Lift",
194201
"Precision-Recall",
195202
"Gains",
196-
"Lift",
197203
]
198204

199205
assert g2["id"] == "discrimination-ppcr"
200206
assert g2["title"] == "By Predicted Positives Condition Rate (PPCR)"
201207
assert [c["id"] for c in g2["components"]] == [
202208
"roc-2",
209+
"lift-2",
203210
"precision-recall-2",
204211
"gains-2",
205-
"lift-2",
206212
]
207213
assert [c["title"] for c in g2["components"]] == [
208214
"ROC",
215+
"Lift",
209216
"Precision-Recall",
210217
"Gains",
211-
"Lift",
212218
]
213219

214220
# Utility section components
@@ -311,12 +317,13 @@ def test_summary_report_times_preserves_standalone_canonical_producers(tmp_path)
311317

312318
report_event_risk = report["sections"][0]["items"][0]["spec"]
313319
assert report_event_risk["schemaVersion"] == "1.1"
320+
assert report_event_risk["title"] == "Event Probability"
314321
report_calib_smooth = report["sections"][1]["items"][0]["spec"]
315322
report_roc_thresh = report["sections"][2]["items"][0]["components"][0]["spec"]
316-
report_pr_thresh = report["sections"][2]["items"][0]["components"][1]["spec"]
323+
report_lift_thresh = report["sections"][2]["items"][0]["components"][1]["spec"]
324+
report_pr_thresh = report["sections"][2]["items"][0]["components"][2]["spec"]
317325
report_roc_ppcr = report["sections"][2]["items"][1]["components"][0]["spec"]
318-
report_gains_ppcr = report["sections"][2]["items"][1]["components"][2]["spec"]
319-
report_lift_thresh = report["sections"][2]["items"][0]["components"][3]["spec"]
326+
report_gains_ppcr = report["sections"][2]["items"][1]["components"][3]["spec"]
320327
report_dc = report["sections"][3]["items"][0]["spec"]
321328
report_ia = report["sections"][3]["items"][1]["spec"]
322329
report_table_thresh = report["sections"][4]["items"][0]["components"][0]["spec"]

0 commit comments

Comments
 (0)