Skip to content
Discussion options

You must be logged in to vote

It's a DoWhy bug in the EconML wrapper, not something in your data. EconML metalearners take a single X, so DoWhy moves the common causes into the effect modifiers and one-hot encodes them (econml.py#L147). estimate_effect then passes that encoded frame (Factor1_B, Factor1_C, ...) to effect(), which selects the original names ['Factor1', 'Factor2'] from it and raises the KeyError (L244, L327). Numeric columns aren't encoded, which is why continuous confounders work. LinearDML hits the same error when a categorical column is an effect modifier.

Workaround: encode before building the model and pass the dummy columns as confounders.

df = pd.get_dummies(data, columns=["Factor1", "Factor2"], d…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kirant1729
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants