Conditional Dependence Profiles (aka Local Profiles) average localy Ceteris Paribus Profiles. Function 'conditional_dependence' calls 'ceteris_paribus' and then 'aggregate_profiles'.

conditional_dependence(x, ...) # S3 method for explainer conditional_dependence( x, variables = NULL, N = 500, variable_splits = NULL, grid_points = 101, ..., variable_type = "numerical" ) # S3 method for default conditional_dependence( x, data, predict_function = predict, label = class(x)[1], variables = NULL, N = 500, variable_splits = NULL, grid_points = 101, ..., variable_type = "numerical" ) # S3 method for ceteris_paribus_explainer conditional_dependence(x, ..., variables = NULL) local_dependency(x, ...) conditional_dependency(x, ...)

x | an explainer created with function |
---|---|

... | other parameters |

variables | names of variables for which profiles shall be calculated.
Will be passed to |

N | number of observations used for calculation of partial dependence profiles. By default |

variable_splits | named list of splits for variables, in most cases created with |

grid_points | number of points for profile. Will be passed to |

variable_type | a character. If |

data | validation dataset, will be extracted from |

predict_function | predict function, will be extracted from |

label | name of the model. By default it's extracted from the |

an object of the class `aggregated_profile_explainer`

Find more details in the Accumulated Local Dependence Chapter.

Explanatory Model Analysis. Explore, Explain, and Examine Predictive Models. https://ema.drwhy.ai/

library("DALEX") library("ingredients") model_titanic_glm <- glm(survived ~ gender + age + fare, data = titanic_imputed, family = "binomial") explain_titanic_glm <- explain(model_titanic_glm, data = titanic_imputed[,-8], y = titanic_imputed[,8], verbose = FALSE) cdp_glm <- conditional_dependence(explain_titanic_glm, N = 150, variables = c("age", "fare")) head(cdp_glm)#> Top profiles : #> _vname_ _label_ _x_ _yhat_ _ids_ #> age.lm.0.1666666667 age lm 0.1666667 0.3762917 0 #> age.lm.2 age lm 2.0000000 0.3713934 0 #> age.lm.4 age lm 4.0000000 0.3662976 0 #> age.lm.7 age lm 7.0000000 0.3591476 0 #> age.lm.9 age lm 9.0000000 0.3547151 0 #> age.lm.13 age lm 13.0000000 0.3466645 0# \donttest{ library("ranger") model_titanic_rf <- ranger(survived ~., data = titanic_imputed, probability = TRUE) explain_titanic_rf <- explain(model_titanic_rf, data = titanic_imputed[,-8], y = titanic_imputed[,8], label = "ranger forest", verbose = FALSE) cdp_rf <- conditional_dependence(explain_titanic_rf, N = 200, variable_type = "numerical") plot(cdp_rf)cdp_rf <- conditional_dependence(explain_titanic_rf, N = 200, variable_type = "categorical") plotD3(cdp_rf, label_margin = 100, scale_plot = TRUE) # }