Trusted-AI / Trusted-AI/AIX360

CEMExplainer support for tabular data with categorical features

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

Nobody has claimed this yet.

Dominant language
Python
Stars
1.8k
Forks
327
Avg merge
1h 13m
Merged PRs (30d)
1

Description

I'm looking to use the contrastive explainer on tabular data which the docs state is supported.

What is the recommended mechanism to deal with categorical features for this explainer?

I've one-hot encoded and then normalized like so:

c_transformer = Pipeline(steps=[('onehot', OneHotEncoder(handle_unknown='ignore')),
                                ('functr', FunctionTransformer(lambda x: x.toarray(), accept_sparse=True)),
                                ('scalar', MinMaxScaler(feature_range=(-0.5, 0.5)))])

The resulting pertinent negatives and positives adjust all values of a category. As an example, here is the delta_pn (which I understand to be the difference needed change the classification) for the sex feature which is binary in this dataset.

sex_Female                                   0.500000
sex_Male                                    -0.500000

The change impacts both categories. Its unclear how to do the inverse transform for these cases when using one-hot encoding.

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 with the CEMExplainer documentation entry point linked in the issue and review the shown scikit-learn preprocessing pipeline. Determine how categorical features should be represented and inverse-transformed so one category change does not produce contradictory one-hot values; the work is done when valid pertinent positives and negatives can be mapped back to categorical data.

Written by the indexing model from the issue text.

Assessment

Tech stack
machine-learning, python, scikit-learn
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.