py-why / py-why/EconML

Attribute ate_ and method ate() give different results in CausalForestDML

Open
#753 2 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

Attribute ate_ and method ate() do not give the same point estimate and confidence interval. I suspect the former applies a doubly robust correction, whereas the latter may not.

Code to reproduce the issue:
import numpy as np
import pandas as pd
from econml.dml import CausalForestDML

# create synthetic data
n = 1000
np.random.seed(1)
T = np.random.randint(2, size=n)
X = np.random.normal(size=(n, 10))
W = np.random.normal(size=(n, 10))
Y = X**2 * T.reshape(-1, 1) + X * W
Y = np.sum(Y, axis=1)

# train model
m = CausalForestDML(discrete_treatment=True, max_features='sqrt', random_state=1)
m.tune(Y=Y, T=T, X=X, W=W)
m.fit(Y=Y, T=T, X=X, W=W)
m.summary()

# get ate (same as summary())
print(m.ate_)
print(m.ate_stderr_)

# get ate (not the same as summary())
print(m.ate(X=X, T0=0, T1=1))
print(m.ate_interval(X=X, T0=0, T1=1, alpha=.05))

The output is:
results

Especially, the confidence interval is substantially different.

The use case is to calculate the ATE for data not used for training.

Thanks!

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

Reproduce the discrepancy with the provided CausalForestDML example, then trace the implementations behind ate_, ate_stderr_, ate(), and ate_interval(). Compare behavior for the fitted data and held-out X, and identify the intended estimate and interval semantics. Done means the APIs agree or their documented differences are tested and clearly explained.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.