Helper functions for predict_parts.R

surv_lime(
  explainer,
  new_observation,
  ...,
  N = 100,
  distance_metric = "euclidean",
  kernel_width = NULL,
  sampling_method = "gaussian",
  sample_around_instance = TRUE,
  max_iter = 10000,
  categorical_variables = NULL,
  k = 1 + 1e-04
)

Arguments

explainer

an explainer object - model preprocessed by the explain() function

new_observation

a new observation for which predictions need to be explained

...

additional parameters, passed to internal functions

N

a positive integer, number of observations generated in the neighbourhood

distance_metric

character, name of the distance metric to be used, only "euclidean" is implemented

kernel_width

a numeric or "silverman", parameter used for calculating weights, by default it's sqrt(ncol(data)*0.75). If "silverman" the kernel width is calculated using the method proposed by Silverman and used in the SurvLIMEpy Python package.

sampling_method

character, name of the method of generating neighbourhood, only "gaussian" is implemented

sample_around_instance

logical, if the neighbourhood should be generated with the new observation as the center (default), or should the mean of the whole dataset be used as the center

max_iter

a numeric, maximal number of iteration for the optimization problem

categorical_variables

character vector, names of variables that should be treated as categories (factors are included by default)

k

a small positive number > 1, added to chf before taking log, so that weigths aren't negative

Value

A list, with the SurvLIME result in the $result field.

References