survex

Explainable Machine Learning in Survival Analysis

https://github.com/modeloriented/survex

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 30 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.5%) to scientific vocabulary

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
Last synced: 6 months ago · JSON representation

Repository

Explainable Machine Learning in Survival Analysis

Basic Info
Statistics
  • Stars: 114
  • Watchers: 6
  • Forks: 10
  • Open Issues: 8
  • Releases: 3
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
Created over 3 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

survex: Explainable Machine Learning in Survival Analysis

R-CMD-check Codecov test coverage CRAN status Total downloads DrWhy-BackBone

Overview

Survival 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.

The survex package provides model-agnostic explanations for machine learning survival models. It is based on the DALEX package. If you're unfamiliar with explainable machine learning, consider referring to the Explanatory Model Analysis book -- most of the methods included in survex extend these described in EMA and implemented in DALEX but to models with functional output.

The 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.

Note 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.

Installation

The package is available on CRAN:

r install.packages("survex")

The latest development version can be installed from GitHub using devtools::install_github():

r devtools::install_github("https://github.com/ModelOriented/survex")

Simple demo

```r library("survex") library("survival") library("ranger")

create a model

model <- ranger(Surv(time, status) ~ ., data = veteran)

create an explainer

explainer <- explain(model, data = veteran[, -c(3, 4)], y = Surv(veteran$time, veteran$status))

evaluate the model

model_performance(explainer)

visualize permutation-based feature importance

plot(model_parts(explainer))

explain one prediction with SurvSHAP(t)

plot(predict_parts(explainer, veteran[1, -c(3, 4)])) ```

Functionalities and roadmap

Existing functionalities: - [x] unified prediction interface using the explainer object - predict() - [x] calculation of performance metrics (Brier Score, Time-dependent C/D AUC, metrics from mlr3proba) - model_performance() - [x] calculation of feature importance (Permutation Feature Importance - PFI) - model_parts() - [x] calculation of partial dependence (Partial Dependence Profiles - PDP, Accumulated Local Effects - ALE) - model_profile() - [x] calculation of 2-dimensional partial dependence (2D PDP, 2D ALE) - model_profile_2d() - [x] calculation of local feature attributions (SurvSHAP(t), SurvLIME) - predict_parts() - [x] calculation of local ceteris paribus explanations (Ceteris Paribus profiles - CP/ Individual Conditional Expectations - ICE) - predict_profile() - [x] calculation of global feature attributions using SurvSHAP(t) - model_survshap()

Currently in develompment: - [ ] ...

Future plans: - [ ] ... (raise an Issue on GitHub if you have any suggestions) - [ ] examples for sursvm and survboost (https://github.com/ModelOriented/survex/issues/88)

Usage

`survex` usage cheatsheet

Citation

If you use survex, please cite our article:

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.

@article{spytek2023survex, author = {Mikołaj Spytek and Mateusz Krzyziński and Sophie Hanna Langbein and Hubert Baniecki and Marvin N Wright and Przemysław Biecek}, title = {survex: an {R} package for explaining machine learning survival models}, journal = {Bioinformatics}, volume = {39}, number = {12}, pages = {btad723}, year = {2023}, month = {12}, doi = {10.1093/bioinformatics/btad723} }

Applications of survex

Related work

Owner

  • Name: Model Oriented
  • Login: ModelOriented
  • Kind: organization
  • Location: MI2DataLab @ Warsaw University of Technology

GitHub Events

Total
  • Issues event: 3
  • Watch event: 14
  • Issue comment event: 3
Last Year
  • Issues event: 3
  • Watch event: 14
  • Issue comment event: 3

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 59
  • Total pull requests: 39
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 5 days
  • Total issue authors: 18
  • Total pull request authors: 5
  • Average comments per issue: 0.92
  • Average comments per pull request: 0.59
  • Merged pull requests: 39
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 4
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 4
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • mikolajsp (18)
  • hbaniecki (16)
  • krzyzinskim (6)
  • pbiecek (2)
  • MosquitoFan (2)
  • Lee-xli (2)
  • lzxcvn (2)
  • alkat19 (1)
  • mao223 (1)
  • Dacy34 (1)
  • patrickheindel (1)
  • billnjcn111 (1)
  • antjejahn (1)
  • dmresearch15 (1)
  • jkylearmstrong (1)
Pull Request Authors
  • mikolajsp (17)
  • krzyzinskim (14)
  • kapsner (3)
  • hbaniecki (2)
  • agosiewska (1)
Top Labels
Issue Labels
feature 💡 (15) invalid ❕ (13) maintenance 🔨 (8) documentation 📚 (5) long term 📅 (3) bug 💣 (3) R 🐳 (1) question ❔ (1)
Pull Request Labels

Packages

  • Total packages: 3
  • Total downloads:
    • cran 415 last-month
  • Total docker downloads: 21,613
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 11
  • Total maintainers: 1
proxy.golang.org: github.com/ModelOriented/survex
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
proxy.golang.org: github.com/modeloriented/survex
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
cran.r-project.org: survex

Explainable Machine Learning in Survival Analysis

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 415 Last month
  • Docker Downloads: 21,613
Rankings
Stargazers count: 7.0%
Forks count: 14.9%
Average: 26.0%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Downloads: 43.0%
Maintainers (1)
Last synced: 7 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • DALEX >= 2.2.1 imports
  • ggplot2 * imports
  • gridExtra * imports
  • ingredients * imports
  • pec * imports
  • survival * imports
  • censored * suggests
  • covr * suggests
  • gbm * suggests
  • generics * suggests
  • glmnet * suggests
  • knitr * suggests
  • mboost * suggests
  • parsnip * suggests
  • progressr * suggests
  • randomForestSRC * suggests
  • ranger * suggests
  • rmarkdown * suggests
  • testthat >= 3.0.0 suggests
  • withr * suggests
  • xgboost * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action 4.1.4 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite