py-why / py-why/EconML

SHAP Values and DynamicDML yields IndexError: list index out of range

Open
#834 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
4.8k
Forks
827
PR merge metrics
No merged PRs in 30d

Description

Hi everyone,

If we do the example from the DynamicDML class

from econml.panel.dml import DynamicDML

np.random.seed(123)

n_panels = 100  # number of panels
n_periods = 3  # number of time periods per panel
n = n_panels * n_periods
groups = np.repeat(a=np.arange(n_panels), repeats=n_periods, axis=0)
X = np.random.normal(size=(n, 1))
T = np.random.normal(size=(n, 2))
y = np.random.normal(size=(n, ))
est = DynamicDML()
est.fit(y, T, X=X, W=None, groups=groups, inference="auto")

and then do shap_values = est.shap_values(X)

we get an IndexError IndexError: list index out of range

Im using econml in version 0.14.1 (the problem persists in 0.15.0b1)

Thank you!

Contributor guide

No contributing guide indexed for this repository

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 running the provided DynamicDML example with est.shap_values(X) on the affected versions and capture the full traceback. Trace the DynamicDML SHAP-values path to identify why it indexes beyond the available list; done means the call completes without IndexError and returns SHAP values for the supplied X.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.