Skip to contents

This function is a generic method that dispatches to the appropriate explain method based on the class of the model.

Usage

explain(
  model,
  data = NULL,
  model_type = NULL,
  baseline_hazard = NULL,
  labtrans = NULL,
  time_bins = NULL,
  preprocess_fun = NULL,
  postprocess_fun = NULL,
  predict_fun = NULL
)

# S3 method for class 'nn_module'
explain(
  model,
  data,
  model_type,
  baseline_hazard = NULL,
  labtrans = NULL,
  time_bins = NULL,
  preprocess_fun = NULL,
  postprocess_fun = NULL,
  predict_fun = NULL
)

# S3 method for class 'extracted_survivalmodels_coxtime'
explain(model, data, ...)

# S3 method for class 'extracted_survivalmodels_deephit'
explain(model, data, ...)

# S3 method for class 'extracted_survivalmodels_deepsurv'
explain(model, data, ...)

Arguments

model

A model object.

data

A data frame or matrix of data to explain the model.

model_type

A string specifying the type of the survival model. Possible values are "coxtime", "deephit", or "deepsurv".

baseline_hazard

A data frame containing the baseline hazard. It should have two columns: "time" and "hazard". This is only used for "coxtime" and "deepsurv" models.

labtrans

A list containing the transformation functions for the time variable. It should have two elements: "transform" and "transform_inv". This is highly experimental and not yet fully supported.

time_bins

A numeric vector specifying the time bins for the "deephit" model, e.g., c(0, 1, 2, 3).

preprocess_fun

A function to preprocess the data before making predictions, e.g., adding a time variable for a coxtime model. This argument is highly experimental and the default values should work for most cases.

postprocess_fun

A function to postprocess the predictions after making them. This argument is highly experimental and the default values should work.

predict_fun

A function that can be used to make predictions from the model. If NULL, the predict method of the model will be used.

...

Unused arguments.

Value

An object of class explainer that contains the model, the data, and the prediction function.