Plot Permutational Feature Importance for Survival Models
Plot Permutational Feature Importance for Survival Models
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().
## 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 "surv_feature_importance" to be plotted
...: additional objects of class "surv_feature_importance" to be plotted together
title: character, title of the plot
subtitle: character, subtitle of the plot, 'default' automatically generates "created for XXX, YYY models", where XXX and YYY are the explainer labels
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 "all", "events", "censors", "none" or NULL. Which times to mark on the x axis in geom_rug().
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.
Returns
An object of the class ggplot.
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)
See Also
Other functions for plotting 'model_parts_survival' objects: plot.model_parts_survival()