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,
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_yelement of the return value.- .bins
See documentation for
ALE()- 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_valuesinALE()
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.
