Calculate the Integrated Gradients of the Survival Function
surv_intgrad.Rd
This function calculates the integrated gradients of the survival function with respect to the input features and time points for a given instance. In the paper, this is referred to as the "IntGrad(t)" method. It shows the attributions of the input features to the target function with respect to a reference input.
Usage
surv_intgrad(
exp,
target = "survival",
instance = 1,
times_input = TRUE,
batch_size = 50,
n = 10,
x_ref = NULL,
dtype = "float",
include_time = FALSE
)
# S3 method for class 'explainer_deepsurv'
surv_intgrad(
exp,
target = "survival",
instance = 1,
times_input = TRUE,
batch_size = 1000,
n = 10,
x_ref = NULL,
dtype = "float",
...
)
# S3 method for class 'explainer_coxtime'
surv_intgrad(
exp,
target = "survival",
instance = 1,
times_input = TRUE,
batch_size = 1000,
n = 10,
x_ref = NULL,
dtype = "float",
include_time = FALSE
)
# S3 method for class 'explainer_deephit'
surv_intgrad(
exp,
target = "survival",
instance = 1,
times_input = TRUE,
batch_size = 1000,
n = 10,
x_ref = NULL,
dtype = "float",
...
)
Arguments
- exp
An object of class
explainer_deepsurv
,explainer_coxtime
, orexplainer_deephit
.- target
A character string indicating the target output. For
DeepSurv
andCoxTime
, it can be either"survival"
(default),"cum_hazard"
, or"hazard"
. ForDeepHit
, it can be"survival"
(default),"cif"
, or"pmf"
.- instance
An integer specifying the instance for which the integrated gradients are calculated. It should be between 1 and the number of instances in the dataset.
- times_input
A logical value indicating whether the integrated gradients should be multiplied with input. Default is
TRUE
.- batch_size
An integer specifying the batch size for processing. The default is 1000. This value describes the number of instances within one batch and not the final number of rows in the batch. For example,
CoxTime
replicates each instance for each time point.- n
An integer specifying the number of approximation points for the integral calculation. Default is 10.
- x_ref
A reference input for the integrated gradients. If
NULL
(default), the mean of the input data is used. It should have the same dimensions as the input data.- dtype
A character string indicating the data type for the tensors. It can be either
"float"
(default) or"double"
.- include_time
A logical value indicating whether to include attributions for the time points. This is only relevant for
CoxTime
and is ignored forDeepSurv
andDeepHit
.- ...
Unused arguments.
See also
Other Attribution Methods:
surv_gradSHAP()
,
surv_grad()
,
surv_smoothgrad()