Provides model explainability across several backends. With method = "dalex" it:
Creates a DALEX explainer from the trained model.
Computes permutation-based variable importance with vi_iterations permutations and displays the table and plot.
Computes partial dependence-like model profiles when features are supplied.
Computes Shapley values (SHAP) for shap_sample training rows, displays the SHAP table,
and plots a summary bar chart of \(\text{mean}(\vert \text{SHAP value} \vert)\) per feature. For classification, separate bars per class are shown.
fastexplain(
object,
method = "dalex",
features = NULL,
variables = NULL,
observation = NULL,
grid_size = 20,
shap_sample = 5,
vi_iterations = 10,
seed = 123,
loss_function = NULL,
protected = NULL,
...
)For DALEX-based methods, prints variable importance, model profiles, and SHAP summaries. Other methods return their respective explainer objects (e.g., LIME explanations, ALE plot, surrogate tree, interaction strengths, modelStudio dashboard, fairmodels object, breakdown object, or counterfactual results), usually invisibly after plotting or printing.
A fastml object.
Character string specifying the explanation method.
Supported values are "dalex", "lime", "ice",
"ale", "surrogate", "interaction", "studio",
"fairness", "breakdown", and "counterfactual".
Defaults to "dalex".
Character vector of feature names for partial dependence (model profiles). Default NULL.
Character vector. Variable names to compute explanations for (used for counterfactuals).
A single observation for methods that need a new data point
(method = "counterfactual" or method = "breakdown"). Default NULL.
Number of grid points for partial dependence. Default 20.
Integer number of observations from processed training data to compute SHAP values for. Default 5.
Integer. Number of permutations for variable importance (B). Default 10.
Integer. A value specifying the random seed.
Function. The loss function for model_parts.
If NULL and task = 'classification', defaults to DALEX::loss_cross_entropy.
If NULL and task = 'regression', defaults to DALEX::loss_root_mean_square.
Character or factor vector of protected attribute(s) required for
method = "fairness". Default NULL.
Additional arguments passed to the underlying helper functions
for the chosen method.
Method dispatch: method can route to LIME, ICE, ALE, surrogate tree, interaction strengths,
DALEX/modelStudio dashboards, fairness diagnostics, iBreakDown contributions, or counterfactual search.
Variable importance controls: Use vi_iterations to tune permutation stability and loss_function
to override the default DALEX loss (cross-entropy for classification, RMSE for regression).
Fairness and breakdown support: Provide protected for method = "fairness" and an observation
for method = "breakdown" or method = "counterfactual". Observations are aligned to the explainer data before scoring.