Conversation
…als) and add checks for valid interval-censored data.
…ent indicator" instead of "censoring indicator" to avoid confusion.
…umerically stable calculation.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
This PR improves correctness and consistency across SurvivalEVAL’s survival-evaluation utilities, interval-censored evaluators, and single-event nonparametric estimators by tightening edge-case handling (boundary probabilities, time-grid alignment, interval semantics, and baseline behavior) and adding regression tests for the corrected behavior.
Changes:
- Added reusable curve/time-grid broadcasting plus direction-aware monotonicity checking/correction (including isotonic regression) and expanded validation for curve/time inputs.
- Fixed multiple metric/evaluator edge cases (e.g., calibration bin boundaries, interval comparability for concordance, COV normalization, AUPRC left-censor extrapolation defaults, exact-interval inclusion logic).
- Updated single-event nonparametric estimators (KM/NA/CopulaGraphic/Turnbull) to include consistent pre-observation baselines and improved exact-observation / infinite-tail support handling, with new regression tests.
Reviewed changes
Copilot reviewed 27 out of 28 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_util.py | Adds regression tests for broadcasting/alignment, zero-padding on 2D grids, monotonicity direction, isotonic correction, and AUPRC validation. |
| tests/test_right2interval.py | Updates monotonicity check call to explicitly use decreasing direction. |
| tests/test_other_metrics.py | Adds regression tests for updated COV behavior and validation. |
| tests/test_nonparametric_estimators.py | Adds regression tests for baseline-at-zero and exact-time handling across nonparametric estimators. |
| tests/test_interval_cen_evaluator.py | Adds regression tests for interval one-calibration bins, concordance return types, exact-interval tolerance, and brier defaults without training data. |
| tests/test_evaluator.py | Adds evaluator regression tests for predict_interval validation, scikit-survival curve repair, 2D grids, and calibration consistency. |
| tests/test_concordance.py | Adds focused tests for directed comparability on interval-censored precedence. |
| SurvivalEVAL/NonparametricEstimator/SingleEvent/util.py | Fixes survival inference for times before first observation by explicitly returning baseline survival=1. |
| SurvivalEVAL/NonparametricEstimator/SingleEvent/Turnbull.py | Refactors Turnbull support to handle exact observations and preserve infinite-tail support while keeping step-function semantics. |
| SurvivalEVAL/NonparametricEstimator/SingleEvent/NelsonAalen.py | Adds explicit baseline-at-zero alignment and improves prediction-time validation/shape handling. |
| SurvivalEVAL/NonparametricEstimator/SingleEvent/KaplanMeier.py | Adds explicit baseline-at-zero alignment and adjusts KM-area baseline reuse and documentation. |
| SurvivalEVAL/NonparametricEstimator/SingleEvent/Fiducial.py | Improves formatting, clarifies docs, and reuses shared monotonicity correction (make_monotonic) instead of a local isotonic implementation. |
| SurvivalEVAL/NonparametricEstimator/SingleEvent/CopulaGraphic.py | Adds explicit baseline-at-zero alignment. |
| SurvivalEVAL/NonparametricEstimator/SingleEvent/init.py | Minor formatting adjustment. |
| SurvivalEVAL/IntervalCenEvaluator.py | Tightens validation for finite/nonnegative left limits, clarifies docs, and normalizes concordance API/returns. |
| SurvivalEVAL/Evaluator.py | Improves API/docs consistency, adds shared curve/time alignment, fixes several boundary behaviors, and refines KM-calibration handling for per-sample grids. |
| SurvivalEVAL/Evaluations/util.py | Introduces align_curve_and_time_coordinates, direction-aware monotonicity checks, isotonic option for monotonic repair, stricter validations, and improved RMST/mean/median helpers. |
| SurvivalEVAL/Evaluations/util_plots.py | Adds future-annotations import for typing consistency. |
| SurvivalEVAL/Evaluations/SingleTimeCalibration.py | Fixes H-statistic bin inclusivity at prediction=1 and corrects bin-size handling after filtering. |
| SurvivalEVAL/Evaluations/OtherMetrics.py | Refactors cov to be a normalized event-time CoV with stricter validation and clearer semantics/docs. |
| SurvivalEVAL/Evaluations/MeanError.py | Improves interval “inside” logic to treat exact intervals specially and updates method docs/logic. |
| SurvivalEVAL/Evaluations/DistributionCalibration.py | Fixes D-calibration binning for prob==1 and improves event-indicator terminology/docs. |
| SurvivalEVAL/Evaluations/Concordance.py | Clarifies event-indicator terminology, updates interval comparability to directed precedence, and tightens midpoint imputation validation. |
| SurvivalEVAL/Evaluations/BrierScore.py | Improves event-indicator terminology and clarifies uncensored IC Brier behavior. |
| SurvivalEVAL/Evaluations/AreaUnderPRCurve.py | Adds curve/time-grid alignment support, improves input checks, and refines left-censor extrapolation behavior. |
| setup.py | Formatting/quoting cleanup and converts TODO block to a proper triple-quoted string. |
| pyproject.toml | Configures pytest to ignore tests/private by default. |
| .github/pull_request_template.md | Updates template pytest instructions and code-fence language tags. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Description
This pull request collects correctness, validation, and consistency fixes across survival evaluation metrics, evaluators, and single-event nonparametric estimators. It addresses probability and time-grid boundary cases, interval-censoring behavior, monotonicity handling, and estimator baselines while adding focused regression coverage for the corrected behavior.
Updates
If this PR adds a new feature, what is the use case, and how to use it?
Fixes
List the issue fixes that are covered in this pull request. If this PR fixes an issue, how to reproduce, expected vs. Incorrect results.
Mandatory Checklist
All new or modified features have corresponding test cases.
I have run all the tests, using
pytest, and this is the log I get:All new functions, classes, and modules contain clear docstrings and inline comments.
All jupyter notebooks are runnable with expected results.
N/A: this PR does not modify notebooks; notebook execution was not validated locally.
I have reformatted and ran
isort .andblack .(in this same order) on the codebase.I have updated the README and added or edited any new scripts to the integration tests.
N/A: no README or integration-script changes are required; focused unit/regression tests were added instead.
I have ensured sufficient coverage on the newly implemented features.
I have made sure that both the
requirements.txtandpyproject.tomlfiles are updated according to the newly introduced dependencies. No new dependencies are introduced by this PR.Paste the remaining code TODOs using the command
grep -rI --color=auto --exclude-dir={.git,__pycache__,env_folder,.venv,venv,.cache,output,.github,} 'TODO' .here, and explain them if necessary:These TODOs predate or are outside the fixes completed in this PR and are left for follow-up work.