| ALE | R Documentation |
Performs an ALE for one or more features.
ALE(
model,
variable = NULL,
data = NULL,
type = "response",
analytical = FALSE,
center = FALSE,
K = 10,
ALE_type = c("equidistant", "quantile"),
plot = TRUE,
parallel = FALSE,
...
)
## S3 method for class 'citodnn'
ALE(
model,
variable = NULL,
data = NULL,
type = "response",
analytical = TRUE,
center = FALSE,
K = 10,
ALE_type = c("quantile", "equidistant"),
plot = TRUE,
parallel = FALSE,
...
)
## S3 method for class 'citodnnBootstrap'
ALE(
model,
variable = NULL,
data = NULL,
type = "response",
analytical = TRUE,
center = FALSE,
K = 10,
ALE_type = c("quantile", "equidistant"),
plot = TRUE,
parallel = FALSE,
...
)
model |
a model created by |
variable |
variable (as a string) for which the ALE should be computed. If none is supplied, it is computed for all variables. |
data |
data on which the ALE is computed; if NULL, the training data is used |
type |
ALE on which scale response or link, default is response |
analytical |
Analytical ALE based on conditional effects or not |
center |
center ALE or not (only available for analytical ALE) |
K |
number of neighborhoods the original feature space is divided into |
ALE_type |
method by which the feature bins (neighborhoods) are created |
plot |
plot ALE or not |
parallel |
parallelize over bootstrap models or not |
... |
arguments passed to |
A list of plots made with 'ggplot2' consisting of an individual plot for each defined variable.
Accumulated Local Effect plots (ALE) quantify how the predictions change when the features change. They are similar to partial dependency plots but are more robust to feature collinearity.
If the defined variable is a numeric feature, the ALE is performed. Here, the non centered effect for feature j with k equally distant neighborhoods is defined as:
\hat{\tilde{f}}_{j,ALE}(x)=\sum_{k=1}^{k_j(x)}\frac{1}{n_j(k)}\sum_{i:x_{j}^{(i)}\in{}N_j(k)}\left[\hat{f}(z_{k,j},x^{(i)}_{\setminus{}j})-\hat{f}(z_{k-1,j},x^{(i)}_{\setminus{}j})\right]
Where N_j(k) is the k-th neighborhood and n_j(k) is the number of observations in the k-th neighborhood.
The last part of the equation,
\left[\hat{f}(z_{k,j},x^{(i)}_{\setminus{}j})-\hat{f}(z_{k-1,j},x^{(i)}_{\setminus{}j})\right]
represents the difference in model prediction when the value of feature j is exchanged with the upper and lower border of the current neighborhood.
PDP
if(torch::torch_is_installed()){
library(cito)
# Build and train Network
nn.fit<- dnn(Sepal.Length~., data = datasets::iris)
ALE(nn.fit, variable = "Petal.Length")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.