.ale {effectplots} | R Documentation |
This is a barebone implementation of Apley's ALE intended for developers.
To get more information on ALE, see ale()
.
.ale(
object,
v,
data,
breaks,
right = TRUE,
pred_fun = stats::predict,
trafo = NULL,
which_pred = NULL,
bin_size = 200L,
w = NULL,
g = NULL,
...
)
object |
Fitted model. |
v |
Variable name in |
data |
Matrix or data.frame. |
breaks |
Breaks for ALE calculation. |
right |
Should bins specified via |
pred_fun |
Prediction function, by default |
trafo |
How should predictions be transformed?
A function or |
which_pred |
If the predictions are multivariate: which column to pick
(integer or column name). By default |
bin_size |
Maximal number of observations used per bin. If there are more
observations in a bin, |
w |
Optional vector with case weights. |
g |
For internal use. The result of |
... |
Further arguments passed to |
Vector of ALE values in the same order as breaks[-length(breaks)]
.
Apley, Daniel W., and Jingyu Zhu. 2020. Visualizing the Effects of Predictor Variables in Black Box Supervised Learning Models. Journal of the Royal Statistical Society Series B: Statistical Methodology, 82 (4): 1059–1086. doi:10.1111/rssb.12377.
fit <- lm(Sepal.Length ~ ., data = iris)
v <- "Sepal.Width"
.ale(fit, v, data = iris, breaks = seq(2, 4, length.out = 5))