accumulated_dependency

0th

Percentile

Accumulated Local Effects Profiles aka ALEPlots

Accumulated Local Effects Profiles accumulate local changes in Ceteris Paribus Profiles. Function 'accumulated_dependency' calls 'ceteris_paribus' and then 'aggregate_profiles'.

Usage
accumulated_dependency(x, ...)

# S3 method for explainer accumulated_dependency(x, variables = NULL, N = 500, variable_splits = NULL, grid_points = 101, ...)

# S3 method for default accumulated_dependency(x, data, predict_function = predict, label = class(x)[1], variables = NULL, grid_points = grid_points, variable_splits = variable_splits, N = 500, ...)

# S3 method for ceteris_paribus_explainer accumulated_dependency(x, ..., variables = NULL)

Arguments
x

a model to be explained, or an explainer created with function `DALEX::explain()` or object of the class `ceteris_paribus_explainer`.

...

other parameters

variables

names of variables for which profiles shall be calculated. Will be passed to `calculate_variable_splits()`. If NULL then all variables from the validation data will be used.

N

number of observations used for calculation of partial dependency profiles. By default, 500 observations will be chosen randomly.

variable_splits

named list of splits for variables, in most cases created with `calculate_variable_splits()`. If NULL then it will be calculated based on validation data avaliable in the `explainer`.

grid_points

number of points for profile. Will be passed to `calculate_variable_splits()`.

data

validation dataset Will be extracted from `x` if it's an explainer

predict_function

predict function Will be extracted from `x` if it's an explainer

label

name of the model. By default it's extracted from the 'class' attribute of the model

Details

Find more detailes in the Accumulated Local Dependency Chapter.

Value

an 'aggregated_profiles_explainer' geom

References

ALEPlot: Accumulated Local Effects (ALE) Plots and Partial Dependence (PD) Plots https://cran.r-project.org/package=ALEPlot, Predictive Models: Visual Exploration, Explanation and Debugging https://pbiecek.github.io/PM_VEE

Aliases
  • accumulated_dependency
  • accumulated_dependency.explainer
  • accumulated_dependency.default
  • accumulated_dependency.ceteris_paribus_explainer
Examples
# NOT RUN {
library("DALEX")
# Toy examples, because CRAN angels ask for them
titanic <- na.omit(titanic)
model_titanic_glm <- glm(survived == "yes" ~ gender + age + fare,
                       data = titanic, family = "binomial")

explain_titanic_glm <- explain(model_titanic_glm,
                           data = titanic[,-9],
                           y = titanic$survived == "yes")
pdp_glm <- accumulated_dependency(explain_titanic_glm, N = 50, variables = c("age", "fare"))
head(pdp_glm)
plot(pdp_glm)

 
# }
# NOT RUN {
library("randomForest")
 model_titanic_rf <- randomForest(survived ~ gender + age + class + embarked +
                                    fare + sibsp + parch,  data = titanic)
 model_titanic_rf

 explain_titanic_rf <- explain(model_titanic_rf,
                           data = titanic[,-9],
                           y = titanic$survived)

pdp_rf <- accumulated_dependency(explain_titanic_rf)
plot(pdp_rf)
# }
Documentation reproduced from package ingredients, version 0.3.3, License: GPL

Community examples

Looks like there are no examples yet.