plot.surv_feature_importance {survex} | R Documentation |
Plot Permutational Feature Importance for Survival Models
Description
This function plots feature importance objects created for survival models using the
model_parts()
function with a time-dependent metric, that is loss_one_minus_cd_auc()
or
loss_brier_score()
.
Usage
## S3 method for class 'surv_feature_importance'
plot(
x,
...,
title = "Time-dependent feature importance",
subtitle = "default",
max_vars = 7,
colors = NULL,
rug = "all",
rug_colors = c("#dd0000", "#222222")
)
Arguments
x |
an object of class |
... |
additional objects of class |
title |
character, title of the plot |
subtitle |
character, subtitle of the plot, |
max_vars |
maximum number of variables to be plotted (least important variables are ignored) |
colors |
character vector containing the colors to be used for plotting variables (containing either hex codes "#FF69B4", or names "blue") |
rug |
character, one of |
rug_colors |
character vector containing two colors (containing either hex codes "#FF69B4", or names "blue"). The first color (red by default) will be used to mark event times, whereas the second (grey by default) will be used to mark censor times. |
Value
An object of the class ggplot
.
See Also
Other functions for plotting 'model_parts_survival' objects:
plot.model_parts_survival()
Examples
library(survival)
library(survex)
model <- coxph(Surv(time, status) ~ ., data = veteran, x = TRUE, model = TRUE, y = TRUE)
model_rf <- randomForestSRC::rfsrc(Surv(time, status) ~ ., data = veteran)
explainer <- explain(model)
explainer_rf <- explain(model_rf)
mp <- model_parts(explainer)
mp_rf <- model_parts(explainer_rf)
plot(mp, mp_rf)