Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[R][feature] Aspect importance #488

Open
talegari opened this issue Mar 15, 2022 · 1 comment
Open

[R][feature] Aspect importance #488

talegari opened this issue Mar 15, 2022 · 1 comment
Labels
feature 💡 New feature or enhancement request R 🐳 Related to R

Comments

@talegari
Copy link

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:

  1. Specifying correlation mechanism (depend_method in python API). Currently, only numeric columns are supported.
  2. Functionality seems to be distributed between triplot,dalexExtra. It would be great to bring it under DALEX 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.

@hbaniecki hbaniecki added feature 💡 New feature or enhancement request R 🐳 Related to R labels Mar 15, 2022
@hbaniecki
Copy link
Member

hbaniecki commented Mar 17, 2022

Hi @talegari, it is good to see interest in Aspect importance.

R's aspect_importance and other related methods were moved from DALEXtra to triplot; they are no longer available in DALEXtra, and the triplot package was meant to support Aspect importance. I believe it was not considered for DALEX, since DALEX has no hard dependencies besides ggplot2, iBreakDown, and ingredients (both, which also only depend on ggplot2).

  1. In Python, we use Power Predictive Score (PPS) [blog, software] to compute relationship between categorical and numerical variables. If you wish to implement new measures for the triplot package, I would be happy to review your contributed PR.
  2. We can consider adding global/local aspect importance into DALEX only if you do so without adding any newly imported dependencies. As for changing the triplot API, you would need to propose a change there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 💡 New feature or enhancement request R 🐳 Related to R
Projects
None yet
Development

No branches or pull requests

2 participants