Calculate the Gradient of the Survival Function
surv_grad.Rd
This function calculates the gradient 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 "Grad(t)" method. It shows the sensitivity of the survival function to changes in the input features at a specific time point.
Usage
surv_grad(
exp,
target = "survival",
instance = 1,
times_input = FALSE,
batch_size = 50,
dtype = "float",
include_time = FALSE
)
# S3 method for class 'explainer_deepsurv'
surv_grad(
exp,
target = "survival",
instance = 1,
times_input = FALSE,
batch_size = 1000,
dtype = "float",
...
)
# S3 method for class 'explainer_coxtime'
surv_grad(
exp,
target = "survival",
instance = 1,
times_input = FALSE,
batch_size = 1000,
dtype = "float",
include_time = FALSE
)
# S3 method for class 'explainer_deephit'
surv_grad(
exp,
target = "survival",
instance = 1,
times_input = FALSE,
batch_size = 1000,
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 gradient is calculated. It should be between 1 and the number of instances in the dataset.
- times_input
A logical value indicating whether the gradient should be multiplied with input. In the paper, this variant is referred to as "GxI(t)".
- 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.- 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 the time points in the output. This is only relevant for
CoxTime
and is ignored forDeepSurv
andDeepHit
.- ...
Unused arguments.
See also
Other Attribution Methods:
surv_gradSHAP()
,
surv_intgrad()
,
surv_smoothgrad()