View source: R/explain_tidysdm.R
explain_tidysdm | R Documentation |
DALEX is designed to explore and explain the behaviour of Machine Learning
methods. This function creates a DALEX explainer (see DALEX::explain()
),
which can then be queried by multiple functions from the DALEX package to
create explanations of the model.
explain_tidysdm(
model,
data,
y,
predict_function,
predict_function_target_column,
residual_function,
...,
label,
verbose,
precalculate,
colorize,
model_info,
type,
by_workflow
)
## Default S3 method:
explain_tidysdm(
model,
data = NULL,
y = NULL,
predict_function = NULL,
predict_function_target_column = NULL,
residual_function = NULL,
...,
label = NULL,
verbose = TRUE,
precalculate = TRUE,
colorize = !isTRUE(getOption("knitr.in.progress")),
model_info = NULL,
type = "classification",
by_workflow = FALSE
)
## S3 method for class 'simple_ensemble'
explain_tidysdm(
model,
data = NULL,
y = NULL,
predict_function = NULL,
predict_function_target_column = NULL,
residual_function = NULL,
...,
label = NULL,
verbose = TRUE,
precalculate = TRUE,
colorize = !isTRUE(getOption("knitr.in.progress")),
model_info = NULL,
type = "classification",
by_workflow = FALSE
)
## S3 method for class 'repeat_ensemble'
explain_tidysdm(
model,
data = NULL,
y = NULL,
predict_function = NULL,
predict_function_target_column = NULL,
residual_function = NULL,
...,
label = NULL,
verbose = TRUE,
precalculate = TRUE,
colorize = !isTRUE(getOption("knitr.in.progress")),
model_info = NULL,
type = "classification",
by_workflow = FALSE
)
model |
object - a model to be explained |
data |
data.frame or matrix - data which will be used to calculate the explanations. If not provided, then it will be extracted from the model. Data should be passed without a target column (this shall be provided as the |
y |
numeric vector with outputs/scores. If provided, then it shall have the same size as |
predict_function |
function that takes two arguments: model and new data and returns a numeric vector with predictions. By default it is |
predict_function_target_column |
Character or numeric containing either column name or column number in the model prediction object of the class that should be considered as positive (i.e. the class that is associated with probability 1). If NULL, the second column of the output will be taken for binary classification. For a multiclass classification setting, that parameter cause switch to binary classification mode with one vs others probabilities. |
residual_function |
function that takes four arguments: model, data, target vector y and predict function (optionally). It should return a numeric vector with model residuals for given data. If not provided, response residuals ( |
... |
other parameters |
label |
character - the name of the model. By default it's extracted from the 'class' attribute of the model |
verbose |
logical. If TRUE (default) then diagnostic messages will be printed |
precalculate |
logical. If TRUE (default) then |
colorize |
logical. If TRUE (default) then |
model_info |
a named list ( |
type |
type of a model, either |
by_workflow |
boolean determining whether a list of explainer, one per model, should be returned instead of a single explainer for the ensemble |
By default, the response variable is extracted form the ensemble object. Note
that, if the response variable is passed directly, y
should be a factor
with presence as a reference level. To check that y
is formatted correctly,
use check_sdm_presence()
.
explainer object DALEX::explain
ready to work with DALEX
# using the whole ensemble
lacerta_explainer <- explain_tidysdm(tidysdm::lacerta_ensemble)
# by workflow
explainer_list <- explain_tidysdm(tidysdm::lacerta_ensemble,
by_workflow = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.