ModelOriented / ModelOriented/DALEX

[R][feature] Aspect importance

Open
#488 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature 💡 R 🐳
Dominant language
Python
Stars
1.5k
Forks
172
PR merge metrics
No merged PRs in 30d

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:

  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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the Python aspect-importance implementation with R's aspect_importance documentation, then trace how triplot and DALEXtra currently divide the functionality. Map the proposed get_aspects, get_variable_groups, model_parts, and predict_parts API before deciding scope. Done should mean the R functionality is unified under DALEX with correlation mechanisms and global/local aspect-importance workflows.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, r
Domain
api, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.