Skip to content

[FIX] Correct probability mass and temporal alignment in _SksurvAdapter #958#970

Open
vishalsnghkush wants to merge 1 commit intosktime:mainfrom
vishalsnghkush:main
Open

[FIX] Correct probability mass and temporal alignment in _SksurvAdapter #958#970
vishalsnghkush wants to merge 1 commit intosktime:mainfrom
vishalsnghkush:main

Conversation

@vishalsnghkush
Copy link

This PR fixes mathematical errors in the predict_proba method of _SksurvAdapter. Previously, the resulting Empirical distributions were improper (weights summed to less than 1.0) and temporally shifted.

Changes:

  1. Initial Mass Preservation: Prepends a survival value of 1.0 to the survival function to capture the first drop from t=0.
  2. Tail Mass Preservation: Appended the remaining survival probability at the last time point to np.inf. This ensures the total mass always sums to 1.0.
  3. Alignment Correction: Fixed the logic where np.diff results were shifted. Probability drops are now correctly mapped to the timestamps where they occur.

Testing & Verification:
Verified using the reproduction script in Issue 958.

  • Before Fix: Total weight was less than 1.0.
  • After Fix: Total weight equals 1.0 and includes np.inf for censored mass.

…ter - Added boundary handling by prepending S(0)=1.0 to survival curves. - Appended remaining survival probability (tail mass) to np.inf. - Corrected temporal alignment of mass drops to match event times. - Resolves Issue sktime#958: weights now sum to 1.0.
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