View source: R/verb-interpret.R
| interpret | R Documentation |
A single entry point to the package's model-agnostic explanation and
diagnostic methods. listmethods() lists the method ids
with a one-line description of each.
interpret(fit, method, newdata = NULL, data = NULL, times = NULL, ...)
fit |
A |
method |
One of |
newdata |
Instances to explain (SHAP, ALE, counterfactual, surrogate,
survcluster) or to assess ( |
data |
Background data for the method. Defaults to the training data. |
times |
Evaluation grid; |
... |
Method-specific arguments, e.g. |
A survalis_interpret object holding the method's result, with
method, times, and a plot() method. as.data.frame() returns the
result frame. For "survcluster" it is in long format, one row per
observation and time: id (row of newdata), cluster, medoid (TRUE
for the cluster's medoid curve), time and predicted survival surv.
For "roc" and "dca" it is the curve with an eval_time column (and
auc for "roc"); for "tree_surrogate" one row per time and feature
with the number of splits on it and the tree's r_squared. For
"pdp" / "ice" it is one row per curve point (feature,
feature_value, id (NA on PDP rows), time, surv, type), for
"ale" one row per feature value and time (feature, feature_value,
time, ale), and for "calibration" the binned table with its
eval_time. For "pdp" and "ale", as.data.frame(x, what = "integrated") returns the curve integrated over time instead (feature,
feature_value, integrated).
For scalar summaries use evaluate(): metrics = "ece" summarises
calibration and metrics = "auc" summarises the ROC curve.
m <- fit(Surv(time, status) ~ age + karno + celltype, veteran, "ranger",
spec = list(num.trees = 100))
interpret(m, "pdp", feature = "karno", times = c(90, 180))
interpret(m, "varimp", times = c(90, 180))
plot(interpret(m, "roc", eval_time = 180))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.