This function is used to calculate permutational feature importance using a time-dependent metric. The result is the change in loss function at each time point after permuting each selected variable.
surv_feature_importance(x,...)## S3 method for class 'surv_explainer'surv_feature_importance( x, loss_function =NULL,..., type = c("raw","ratio","difference"), B =10, variables =NULL, variable_groups =NULL, N =NULL, label =NULL)
Arguments
x: an explainer object - model preprocessed by the explain() function
...: other parameters, currently ignored
loss_function: a function that will be used to assess variable importance, by default loss_brier_score for survival models. The function can be supplied manually but has to have these named parameters (y_true, risk, surv, times), where y_true represents the survival::Surv object with observed times and statuses, risk is the risk score calculated by the model, and surv is the survival function for each observation evaluated at times.
type: a character vector, if "raw" the results are losses after the permutation, if "ratio" the results are in the form loss/loss_full_model and if "difference" the results are of the form loss - loss_full_model`
B: numeric, number of permutations to be calculated
variables: a character vector, names of variables to be included in the calculation
variable_groups: a list of character vectors of names of explanatory variables. For each vector, a single variable importance measure is computed for the joint effect of the variables which names are provided in the vector. By default, variable_groups = NULL, in which case variable importance measures are computed separately for all variables indicated in the variables argument.
N: numeric, number of observations that are to be sampled from the dataset for the purpose of calculation
label: label of the model, if provided overrides explainer$label
Returns
A data.frame containing results of the calculation.
Details
Note: This function can be run within progressr::with_progress() to display a progress bar, as the execution can take long, especially on large datasets.