{"id":13704388,"url":"https://github.com/ModelOriented/survex","last_synced_at":"2025-05-05T09:33:44.744Z","repository":{"id":58627874,"uuid":"530990061","full_name":"ModelOriented/survex","owner":"ModelOriented","description":"Explainable Machine Learning in Survival Analysis","archived":false,"fork":false,"pushed_at":"2024-06-15T13:15:47.000Z","size":323988,"stargazers_count":111,"open_issues_count":8,"forks_count":10,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-14T10:42:55.610Z","etag":null,"topics":["biostatistics","brier-scores","censored-data","cox-model","cox-regression","explainable-ai","explainable-machine-learning","explainable-ml","explanatory-model-analysis","interpretable-machine-learning","interpretable-ml","machine-learning","probabilistic-machine-learning","r","r-package","shap","survival-analysis","time-to-event","variable-importance","xai"],"latest_commit_sha":null,"homepage":"https://modeloriented.github.io/survex","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ModelOriented.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-31T08:07:03.000Z","updated_at":"2025-04-08T02:22:26.000Z","dependencies_parsed_at":"2024-04-16T09:38:15.205Z","dependency_job_id":"c99f02bc-1bac-4f4b-ab5b-298d29748898","html_url":"https://github.com/ModelOriented/survex","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModelOriented%2Fsurvex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModelOriented%2Fsurvex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModelOriented%2Fsurvex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModelOriented%2Fsurvex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ModelOriented","download_url":"https://codeload.github.com/ModelOriented/survex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252471724,"owners_count":21753239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["biostatistics","brier-scores","censored-data","cox-model","cox-regression","explainable-ai","explainable-machine-learning","explainable-ml","explanatory-model-analysis","interpretable-machine-learning","interpretable-ml","machine-learning","probabilistic-machine-learning","r","r-package","shap","survival-analysis","time-to-event","variable-importance","xai"],"created_at":"2024-08-02T21:01:08.697Z","updated_at":"2025-05-05T09:33:42.383Z","avatar_url":"https://github.com/ModelOriented.png","language":"R","funding_links":[],"categories":["Tools"],"sub_categories":["Interpretability/Explicability"],"readme":"# survex: Explainable Machine Learning in Survival Analysis \u003cimg src=\"man/figures/survex.png\" align=\"right\" width=\"150px\"/\u003e\n\n[![R-CMD-check](https://github.com/ModelOriented/survex/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ModelOriented/survex/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/ModelOriented/survex/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ModelOriented/survex?branch=main)\n[![CRAN status](https://www.r-pkg.org/badges/version/survex)](https://cran.r-project.org/package=survex)\n[![Total downloads](https://cranlogs.r-pkg.org/badges/grand-total/survex?color=orange)](https://cranlogs.r-pkg.org/badges/grand-total/survex)\n[![DrWhy-BackBone](https://img.shields.io/badge/DrWhy-BackBone-373589)](http://drwhy.ai/#BackBone)\n\n\n## Overview \n\nSurvival analysis is a task dealing with time-to-event prediction. Aside from the well-understood models like CPH, many more complex models have recently emerged, but most lack interpretability. Due to a functional type of prediction, either in the form of a survival function or a cumulative hazard function, standard model-agnostic explanations cannot be applied directly.\n\nThe `survex` package provides model-agnostic explanations for machine learning survival models. It is based on the [`DALEX` package](https://github.com/ModelOriented/DALEX). If you're unfamiliar with explainable machine learning, consider referring to the [Explanatory Model Analysis](https://ema.drwhy.ai) book -- most of the methods included in `survex` extend these described in EMA and implemented in `DALEX` but to models with functional output. \n\nThe main `explain()` function uses a model and data to create a standardized `explainer` object, which is further used as an interface for calculating predictions. We automate creating explainers from the following packages: `mlr3proba`, `censored`, `ranger`, `randomForestSRC`, and `survival`. **Raise an Issue on GitHub if you find models from other packages that we can incorporate into the `explain()` interface.**\n\nNote that an explainer can be created for **any** survival model, using the `explain_survival()` function by passing `model`, `data`, `y`, and `predict_survival_function` arguments.\n\n\n## Installation\n\nThe package is available on [CRAN](https://cran.r-project.org/package=survex):\n\n```r\ninstall.packages(\"survex\")\n```\n\nThe latest development version can be installed from GitHub using `devtools::install_github()`:\n\n```r\ndevtools::install_github(\"https://github.com/ModelOriented/survex\")\n```\n\n## Simple demo\n\n```r\nlibrary(\"survex\")\nlibrary(\"survival\")\nlibrary(\"ranger\")\n\n# create a model\nmodel \u003c- ranger(Surv(time, status) ~ ., data = veteran)\n\n# create an explainer\nexplainer \u003c- explain(model, \n                     data = veteran[, -c(3, 4)],\n                     y = Surv(veteran$time, veteran$status))\n\n# evaluate the model\nmodel_performance(explainer)\n\n# visualize permutation-based feature importance\nplot(model_parts(explainer))\n\n# explain one prediction with SurvSHAP(t)\nplot(predict_parts(explainer, veteran[1, -c(3, 4)]))\n```\n\n## Functionalities and roadmap\n\nExisting functionalities:\n- [x] unified prediction interface using the explainer object - `predict()`\n- [x] calculation of performance metrics (Brier Score, Time-dependent C/D AUC, metrics from `mlr3proba`) - `model_performance()`\n- [x] calculation of feature importance (Permutation Feature Importance - PFI) - `model_parts()`\n- [x] calculation of partial dependence (Partial Dependence Profiles - PDP, Accumulated Local Effects - ALE) - `model_profile()`\n- [x] calculation of 2-dimensional partial dependence (2D PDP, 2D ALE) - `model_profile_2d()`\n- [x] calculation of local feature attributions (SurvSHAP(t), SurvLIME) - `predict_parts()`\n- [x] calculation of local ceteris paribus explanations (Ceteris Paribus profiles - CP/ Individual Conditional Expectations - ICE) - `predict_profile()`\n- [x] calculation of global feature attributions using SurvSHAP(t) - `model_survshap()`\n\nCurrently in develompment:\n- [ ] ...\n\nFuture plans:\n- [ ] ... (raise an Issue on GitHub if you have any suggestions)\n- [ ] examples for sursvm and survboost (https://github.com/ModelOriented/survex/issues/88)\n\n## Usage\n\n[![`survex` usage cheatsheet](man/figures/cheatsheet.png)](https://github.com/ModelOriented/survex/blob/main/misc/cheatsheet.pdf)\n\n\n## Citation\n\nIf you use `survex`, please cite [our article](https://doi.org/10.1093/bioinformatics/btad723):\n\n\u003e M. Spytek, M. Krzyziński, S. H. Langbein, H. Baniecki, M. N. Wright, P. Biecek. *survex: an R package for explaining machine learning survival models*. **Bioinformatics**, Volume 39, Issue 12, btad723, 2023.\n\n```\n@article{spytek2023survex,\n    author  = {Mikołaj Spytek and Mateusz Krzyziński and Sophie Hanna Langbein and \n               Hubert Baniecki and Marvin N Wright and Przemysław Biecek},\n    title   = {survex: an {R} package for explaining machine learning survival models},\n    journal = {Bioinformatics},\n    volume  = {39},\n    number  = {12},\n    pages   = {btad723},\n    year    = {2023},\n    month   = {12},\n    doi     = {10.1093/bioinformatics/btad723}\n}\n```\n\n## Applications of `survex`\n\n- H. Baniecki, B. Sobieski, P. Bombiński, P. Szatkowski, P. Biecek. [Hospital Length of Stay Prediction Based on Multi-modal Data towards Trustworthy Human-AI Collaboration in Radiomics](https://arxiv.org/abs/2303.09817). *International Conference on Artificial Intelligence in Medicine*, 2023.\n- W. Chen, B. Zhou, C. Y. Jeon, F. Xie, Y.-C. Lin, R. K. Butler, Y. Zhou, T. Q. Luong, E. Lustigova, J. R. Pisegna, B. U. Wu. [Machine learning versus regression for prediction of sporadic pancreatic cancer](https://doi.org/10.1016/j.pan.2023.04.009). *Pancreatology*, 2023.\n- M. Nachit, Y. Horsmans, R. M. Summers, I. A. Leclercq, P. J. Pickhardt. [AI-based CT Body Composition Identifies Myosteatosis as Key Mortality Predictor in Asymptomatic Adults](https://doi.org/10.1148/radiol.222008). *Radiology*, 2023.\n- R. Passera, S. Zompi, J. Gill, A. Busca. [Explainable Machine Learning (XAI) for Survival in Bone Marrow Transplantation Trials: A Technical Report](https://doi.org/10.3390/biomedinformatics3030048). *BioMedInformatics*, 2023.\n- P. Donizy, M. Spytek, M. Krzyziński, K. Kotowski, A. Markiewicz, B. Romanowska-Dixon, P. Biecek, M. P. Hoang. [Ki67 is a better marker than PRAME in risk stratification of BAP1-positive and BAP1-loss uveal melanomas](http://dx.doi.org/10.1136/bjo-2023-323816). *British Journal of Ophthalmology*, 2023.\n- X. Qi, Y. Ge, A. Yang, Y. Liu, Q. Wang, G. Wu. [Potential value of mitochondrial regulatory pathways in the clinical application of clear cell renal cell carcinoma: a machine learning-based study](https://doi.org/10.1007/s00432-023-05393-8). *Journal of Cancer Research and Clinical Oncology*, 2023.\n- C. C. Lee, S. Y. Su, S. F. Sung. [Machine learning-based survival analysis approaches for predicting the risk of pneumonia post-stroke discharge](https://doi.org/10.1016/j.ijmedinf.2024.105422). *International Journal of Medical Informatics*, 2024.\n- P. Wang, X. Qian, W. Jiang, H. Wang, Y. Wang, Y. Zhou, Y. Zhang, Y. Huang, X. Zhai. [Cord Blood Transplantation for Very Early‑Onset Inflammatory Bowel Disease Caused by Interleukin‑10 Receptor Deficiency](https://doi.org/10.1007/s10875-024-01669-x). *Journal of Clinical Immunology*, 2024.\n- E. Ruiz, J. Honles, R. Fernández, K. Uribe, J. P. Cerapio, K. Cancino, J. Contreras-Mancilla, S. Casavilca-Zambrano, F. Berrospi, P. Pineau, S. Bertani. [A preoperative risk score based on early recurrence for estimating outcomes after resection of hepatocellular carcinoma in the non-cirrhotic liver](https://doi.org/10.1016/j.hpb.2024.02.010). *HPB*, 2024.\n- Share it with us!\n\n## Related work\n\n- H. Ishwaran, U. B. Kogalur, E. H. Blackstone, M. S. Lauer. [Random survival forests](https://doi.org/10.1214/08-AOAS169). *Annals of Applied Statistics*, 2008.\n- A. Grudziąż, A. Gosiewska, P. Biecek. [survxai: an R package for structure-agnostic explanations of survival models](https://doi.org/10.21105/joss.00961). *Journal of Open Source Software*, 2018.\n- M. S. Kovalev, L. V. Utkin, E. M. Kasimov. [SurvLIME: A method for explaining machine learning survival models](https://doi.org/10.1016/j.knosys.2020.106164). *Knowledge-Based Systems*, 2020.\n- R. Sonabend, F. J. Király, A. Bender, B. Bischl, M. Lang. [mlr3proba: an R package for machine learning in survival analysis](https://doi.org/10.1093/bioinformatics/btab039). *Bioinformatics*, 2021.\n- E. Hvitfeldt, H. Frick. [censored: 'parsnip' Engines for Survival Models](https://github.com/tidymodels/censored). *CRAN v0.1.0*, 2022.\n- M. Krzyziński, M. Spytek, H. Baniecki, P. Biecek. [SurvSHAP(t): Time-dependent explanations of machine learning survival models](https://doi.org/10.1016/j.knosys.2022.110234). *Knowledge-Based Systems*, 2023.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FModelOriented%2Fsurvex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FModelOriented%2Fsurvex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FModelOriented%2Fsurvex/lists"}