Open
Description
Team Dalex,
As compared to the python implementation, it appears that R's aspect_importance does not seem to have some functionalities and non unified API:
- Specifying correlation mechanism (
depend_method
in python API). Currently, only numeric columns are supported. - Functionality seems to be distributed between
triplot
,dalexExtra
. It would be great to bring it underDALEX
like python API does. Here are some thoughts:
# create explainer
exp = explain(model, data, y)
# create aspects object/class instead of passing `variable_groups` to `triplot::predict_aspects`
# when `variable_groups` is specified, `depend_method` should be NULL
exp_asp = get_aspects(exp, depend_method = 'association', variable_groups)
# get variable groups at required cutpoint in hclust
# called 'group_variables' in triplot
vg = get_variable_groups(exp_asp, h = 1, n = 5) # either h or n
# get global aspect importance
# triplot has `predict_aspects` which seems like a local method, but actually it is global
# one among h, n and variable_groups should be provided
model_parts(exp_asp, type = "variable_importance", h, n, variable_groups) # should have print and plot methods
# get local aspect importance
# one among h, n and variable_groups should be provided
predict_parts(exp_asp, type = "shap", seed = 1, h, n, variable_groups, show_triplot = FALSE)
# This will keep the API consistent with python
# and the user need not worry calling `aspect_importance`, `predict_triplot` from different packages
# knowing DALEX's `predict_parts`, `model_parts` will suffice
I will be happy to contribute, let me know if a PR is welcome.