py-why / py-why/EconML

y should be a 1d array ERROR

Open
#645 1 comment 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 am trying to run econml methods on 'multiple methods';

with continuous variables

there seems to be no problem when running the 'linear estimate'; however, i get the 'y should be a 1d array, got an array of shape (66516, 4) instead.' when running dml.dml or other methods.

i am trying to use the following code which works for backdoor.linearregression;

dml_estimate = model.estimate_effect(identified_estimand, method_name="backdoor.econml.dml.DML",
control_value = (0,0,0,0),
treatment_value = (1,1,1,1),
target_units = 1, # condition used for CATE
confidence_intervals=False,
method_params={"init_params":{'model_y':GradientBoostingRegressor(),
'model_t': GradientBoostingRegressor(),
"model_final":LassoCV(fit_intercept=False),
'featurizer':PolynomialFeatures(degree=1, include_bias=True)},
"fit_params":{}})

Here, the model is :
model=CausalModel(
data = pmid_regress2,
treatment= ['v1', 'v2', 'v3', 'v4'],
outcome= ['relative_citation_ratio'],
graph=graph
)

with pmid_regress2 being a dataframe; and outcome a specific column

Regards,

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 reproducing the reported shape error through model.estimate_effect with backdoor.econml.dml.DML, then compare it with the working backdoor.linearregression path. Inspect how CausalModel receives the multi-column treatment and single-column outcome, and trace the DML entry point; done means the cause and supported input shape are confirmed and reflected in the issue or documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.