comprisk: A scikit-learn-compatible Python toolkit for competing-risks survival analysis
Summary
comprisk is a scikit-learn-compatible Python toolkit designed for competing-risks survival analysis, addressing the issue where standard methods yield biased absolute-risk estimates in medical time-to-event data. Released in July 2026, it consolidates canonical methods like a scalable competing-risks random survival forest, Fine–Gray subdistribution-hazard regression (including penalized variants), cause-specific Cox regression, the Aalen–Johansen CIF estimator, and Gray's $K$-sample test. The package also includes competing-risks-aware model evaluation metrics such as IPCW time-dependent AUC and Brier score, cause-specific concordance indices, and calibration curves. Its histogram-based, numba-compiled split kernel fits 10–22$ imes$ faster than randomForestSRC, scaling to $n=10^{6}$ on a consumer CPU, and is numerically validated against established R reference implementations.
Key takeaway
For data scientists and epidemiologists building risk-prediction models with competing-risks outcomes, comprisk offers a robust, scikit-learn-compatible solution within Python. You can now perform correct and scalable competing-risks analysis, including advanced forest models and validated regression techniques, without fragmenting your workflow with Python-to-R round trips. This streamlines reproducible research and ensures consistent results with established literature.
Key insights
Correct competing-risks analysis requires specialized methods to avoid biased absolute-risk estimates in time-to-event data.
Principles
- Standard survival methods bias competing-risk estimates.
- Cause-specific CIFs are essential for accuracy.
- Numerical validation against R references ensures consistency.
Method
comprisk employs a histogram-based, numba-compiled split kernel for its random survival forest, enabling sub-linear wall-time growth and parallel tree growth across cores.
In practice
- Use comprisk for scalable competing-risks analysis in Python.
- Validate models using IPCW time-dependent AUC/Brier scores.
- Leverage TreeSHAP for cause-specific attributions.
Topics
- Competing Risks
- Survival Analysis
- scikit-learn
- Python Libraries
- Random Survival Forests
- Electronic Health Records
Code references
Best for: AI Engineer, AI Scientist, Data Scientist, Research Scientist, Machine Learning Engineer
Related on AIssential
See Counsel's argued verdicts on the open AI decisions leaders are weighing →
Editorial summary, takeaway, and curation by AIssential. Original article published by stat.ML updates on arXiv.org.