Skip to content

Fix time-dependent gains reference ownership - #370

Merged
uriahf merged 3 commits into
mainfrom
semantics/fix-time-gains-population-ownership
Aug 21, 2026
Merged

Fix time-dependent gains reference ownership#370
uriahf merged 3 commits into
mainfrom
semantics/fix-time-gains-population-ownership

Conversation

@uriahf

@uriahf uriahf commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Goal

Finish the production-semantic parity stage by aligning time-dependent gains with the stable population-based reference ownership introduced in #368.

Problem

create_gains_curve_times() still used a gains-specific reference replacement path that inferred whether there were multiple populations from horizon-specific event-risk data. Distinct keyed populations with equal event risk could therefore collapse to one perfect-model reference at that horizon.

Change

Route the public time-dependent gains path through the shared population-aware time reference helper already used by ROC, precision-recall, lift, decision curves, and interventions avoided.

This preserves the existing gains formulas and public API while making reference ownership depend on stable population identity rather than numerical event-risk equality.

Tests

Add public regression coverage verifying that:

  • distinct keyed populations with equal event risk retain distinct population-owned perfect-model gains references;
  • multiple models evaluated against shared outcome/time arrays continue to share one population-level perfect-model reference.

Scope

Python only. No statistical formula changes, no public API changes, no R changes, and no rtichoke_viz changes.

CI note

The initial run stopped at Ruff because the refactor left four stale imports in gains.py; those are cleanup-only and do not affect the semantic change.

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-21 14:55 UTC

@uriahf
uriahf marked this pull request as ready for review August 21, 2026 14:55
@uriahf
uriahf merged commit 1fab078 into main Aug 21, 2026
6 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