py-why / py-why/EconML

CausalForestDML with binary outcome and treatment

Open
#779 3 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, I'm building a causal forest with binary outcome and binary treatment.
I have sufficient observations (over 100K) for two groups, but the model doesn't seem to work well because const_marginal_ate is -0.00152163 and feature_importances_ returns an array of zeros looking like array([0., 0., 0.,...

Could you let me know a) CausalForestDML is the right method to use for binary outcome and binary treatment and b) the model setting below is correct?

# set variables for causal forest 
Y = train[one variable]
T = train[one variable]
X = train[20 variables]
W = None
X_test = test[20 variables]

# set parameters for causal forest 
est = CausalForestDML(criterion='het',
                                min_impurity_decrease=0.001,
                                n_estimators=1000,       
                                min_samples_leaf=10, 
                                max_depth=None, 
                                max_samples=0.5,
                                discrete_treatment=True,
                                honest=True,
                                inference=True,
                                cv=5,
                                model_t=RandomForestClassifier(random_state=0), 
                                model_y=RandomForestClassifier(random_state=0),
                                )

# Fit the model
est.fit(Y, T, X=X, W=W)

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 at the CausalForestDML entry point and review the supplied fit configuration, especially binary outcome and treatment handling. Reproduce the reported const_marginal_ate and feature_importances_ results with the shown model settings, then determine whether the behavior is expected or indicates a defect. Done requires a documented maintainer conclusion or a narrowly defined change.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, scikit-learn
Domain
machine-learning
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.