-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathplot.surv_feature_importance.Rd
64 lines (53 loc) · 2.31 KB
/
plot.surv_feature_importance.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot_surv_feature_importance.R
\name{plot.surv_feature_importance}
\alias{plot.surv_feature_importance}
\title{Plot Permutational Feature Importance for Survival Models}
\usage{
\method{plot}{surv_feature_importance}(
x,
...,
title = "Time-dependent feature importance",
subtitle = "default",
max_vars = 7,
colors = NULL,
rug = "all",
rug_colors = c("#dd0000", "#222222")
)
}
\arguments{
\item{x}{an object of class \code{"surv_feature_importance"} to be plotted}
\item{...}{additional objects of class \code{"surv_feature_importance"} to be plotted together}
\item{title}{character, title of the plot}
\item{subtitle}{character, subtitle of the plot, \code{'default'} automatically generates "created for XXX, YYY models", where XXX and YYY are the explainer labels}
\item{max_vars}{maximum number of variables to be plotted (least important variables are ignored)}
\item{colors}{character vector containing the colors to be used for plotting variables (containing either hex codes "#FF69B4", or names "blue")}
\item{rug}{character, one of \code{"all"}, \code{"events"}, \code{"censors"}, \code{"none"} or \code{NULL}. Which times to mark on the x axis in \code{geom_rug()}.}
\item{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 \code{ggplot}.
}
\description{
This function plots feature importance objects created for survival models using the
\code{model_parts()} function with a time-dependent metric, that is \code{loss_one_minus_cd_auc()} or
\code{loss_brier_score()}.
}
\examples{
\donttest{
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)
}
}
\seealso{
Other functions for plotting 'model_parts_survival' objects:
\code{\link{plot.model_parts_survival}()}
}
\concept{functions for plotting 'model_parts_survival' objects}