The `explain()` function is a wrapper for `DALEX` methods for model explanations. If possible it will use methods for tree-based models.
explain(models, test_data, y, verbose = FALSE)
A single model or the model list created with the `train()` function.
A test dataset returned from `train()` function.
A target variable. It can be either (1) a vector of the same number of observations as `data` or (2) a character name of variable in the `data` that contains the target variable.
A logical value determining whether explainer creation messages should be printed or not.
A list of DALEX explainers for 5 models of different engines.
data(lisbon)
train_output <- train(lisbon, 'Price', verbose = FALSE, random_evals = 2, bayes_iter = 1)
best_explainer <- explain(train_output$best_models[[1]][1], train_output$valid_data, train_output$y)
best_explainers <- explain(train_output$best_models[[1]], train_output$valid_data, train_output$y)