Calculate the SmoothGrad values of the Survival Function
surv_smoothgrad.Rd
This function calculates the SmoothGrad values 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 "SG(t)" method. It shows the smoothed sensitivity of the survival function to changes in the input features at a specific time point.
Usage
surv_smoothgrad(
exp,
target = "survival",
instance = 1,
times_input = FALSE,
batch_size = 50,
n = 10,
noise_level = 0.1,
dtype = "float",
include_time = FALSE
)
# S3 method for class 'explainer_deepsurv'
surv_smoothgrad(
exp,
target = "survival",
instance = 1,
times_input = FALSE,
batch_size = 1000,
n = 10,
noise_level = 0.1,
dtype = "float",
...
)
# S3 method for class 'explainer_coxtime'
surv_smoothgrad(
exp,
target = "survival",
instance = 1,
times_input = FALSE,
batch_size = 1000,
n = 10,
noise_level = 0.1,
dtype = "float",
include_time = FALSE
)
# S3 method for class 'explainer_deephit'
surv_smoothgrad(
exp,
target = "survival",
instance = 1,
times_input = FALSE,
batch_size = 1000,
n = 10,
noise_level = 0.1,
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 SmoothGrad is calculated. It should be between 1 and the number of instances in the dataset.
- times_input
A logical value indicating whether the SmoothGrad should be multiplied with input. In the paper, this variant is referred to as
"SGxI(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.- n
An integer specifying the number of noise samples to be added to the input features. The default is 10.
- noise_level
A numeric value specifying the level of Gaussian noise to be added to the input features. The default is 0.1.
- 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 also calculate the gradients with respect to the time. This is only relevant for
CoxTime
and is ignored forDeepSurv
andDeepHit
.- ...
Unused arguments.
See also
Other Attribution Methods:
surv_gradSHAP()
,
surv_grad()
,
surv_intgrad()