This function is not exported. It is a complete reimplementation of the ALE algorithm relative to the reference in ALEPlot::ALEPlot()
. In addition to adding bootstrapping and handling of categorical y variables, it reimplements categorical x interactions.
Usage
calc_ale(
data,
model,
x_cols,
y_col,
y_cats,
pred_fun,
pred_type,
max_num_bins,
boot_it,
seed,
boot_alpha,
boot_centre,
boot_ale_y = FALSE,
bins = NULL,
ns = NULL,
ale_y_norm_funs = NULL,
p_dist = NULL
)
Arguments
- data
See documentation for
ale()
- model
See documentation for
ale()
- x_cols
character(1 or 2). Names of columns in X for which ALE data is to be calculated. Length 1 for 1D ALE and length 2 for 2D ALE.
- y_col
character(1). Name of the target y column.
- y_cats
character. The categories of y. For most cases with non-categorical y,
y_cats == y_col
.- pred_fun
See documentation for
ale()
- pred_type
See documentation for
ale()
- max_num_bins
See documentation for
ale()
- boot_it
See documentation for
ale()
- seed
See documentation for
ale()
- boot_alpha
See documentation for
ale()
- boot_centre
See documentation for
ale()
- boot_ale_y
logical(1). If
TRUE
, return the bootstrap matrix of ALE y values. IfFALSE
(default) return NULL for theboot_ale_y
element of the return value.- bins, ns
numeric or ordinal vector,integer vector. Normally generated automatically (if
bins == NULL
), but if provided, the provided values will be used instead. They would mainly be provided frommodel_bootstrap()
.- ale_y_norm_funs
list of functions. Custom functions for normalizing ALE y for statistics. It is usually a list(1), but for categorical y, there is a distinct function for each y category. If provided, ale_y_norm_funs saves some time since it is usually the same for all all variables throughout one call to
ale()
. For now, used as a flag to determine whether statistics will be calculated or not; if NULL, statistics will not be calculated.- p_dist
See documentation for
p_values
inale()
Details
For details about arguments not documented here, see ale()
.
References
Apley, Daniel W., and Jingyu Zhu. "Visualizing the effects of predictor variables in black box supervised learning models." Journal of the Royal Statistical Society Series B: Statistical Methodology 82.4 (2020): 1059-1086.
Okoli, Chitu. 2023. “Statistical Inference Using Machine Learning and Classical Techniques Based on Accumulated Local Effects (ALE).” arXiv. doi:10.48550/arXiv.2310.09877.