SurvHive: a package to consistently access multiple survival-analysis packages
Giovanni Birolo, Ivan Rossi, Flavio Sartori, Cesare Rollo, Tiziana Sanavia, Piero Fariselli
TL;DR
SurvHive addresses the fragmentation of survival-analysis implementations by offering a unified, scikit-learn–style interface that wraps diverse methods from scikit-survival, PyCox, and other libraries. The core is SurvivalEstimator, a dataclass implementing the Adapter pattern to expose fit, predict, score, and predict_survival across classical and deep-learning models, including a time-dependent survival function $S(t)$. It provides time-aware evaluation metrics (Antolini's C-index, Brier score, AUROC) and an optimization module for censored data, along with dataset utilities and benchmark examples, enabling robust cross-model comparison. By standardizing interfaces and easing hyperparameter tuning and evaluation, SurvHive lowers barriers for practitioners to deploy ML-based survival models and fosters broader adoption in time-to-event modeling.
Abstract
Survival analysis, a foundational tool for modeling time-to-event data, has seen growing integration with machine learning (ML) approaches to handle the complexities of censored data and time-varying risks. Despite these advances, leveraging state-of-the-art survival models remains a challenge due to the fragmented nature of existing implementations, which lack standardized interfaces and require extensive preprocessing. We introduce SurvHive, a Python-based framework designed to unify survival analysis methods within a coherent and extensible interface modeled on scikit-learn. SurvHive integrates classical statistical models with cutting-edge deep learning approaches, including transformer-based architectures and parametric survival models. Using a consistent API, SurvHive simplifies model training, evaluation, and optimization, significantly reducing the barrier to entry for ML practitioners exploring survival analysis. The package includes enhanced support for hyper-parameter tuning, time-dependent risk evaluation metrics, and cross-validation strategies tailored to censored data. With its extensibility and focus on usability, SurvHive provides a bridge between survival analysis and the broader ML community, facilitating advancements in time-to-event modeling across domains. The SurvHive code and documentation are available freely at https://github.com/compbiomed-unito/survhive.
