Fit white box model to the simulated data.

fit_explanation(live_object, white_box = "regr.lm",
  kernel = gaussian_kernel, standardize = FALSE, selection = FALSE,
  response_family = "gaussian", predict_type = "response",
  hyperpars = list())

Arguments

live_object

List return by add_predictions function.

white_box

String, learner name recognized by mlr package.

kernel

function which will be used to calculate distance between simulated observations and explained instance.

standardize

If TRUE, numerical variables will be scaled to have mean 0, variance 1 before fitting explanation model.

selection

If TRUE, variable selection based on glmnet implementation of LASSO will be performed.

response_family

family argument to glmnet (and then glm) function. Default value is "gaussian"

predict_type

Argument passed to mlr::makeLearner() argument "predict.type". Defaults to "response".

hyperpars

Optional list of values of hyperparameteres of a model.

Value

List of class "live_explainer" that consists of

data

Dataset used to fit explanation model (may have less column than the original)

model

Fitted explanation model

explained_instance

Instance that is being explained

weights

Weights used in model fitting

selected_variables

Names of selected variables

Examples

# NOT RUN {
fitted_explanation <- fit_explanation(local_exploration1, "regr.lm", selection = TRUE)
# }