EconML icon indicating copy to clipboard operation
EconML copied to clipboard

y should be a 1d array ERROR

Open apratim-mishra opened this issue 3 years ago • 1 comments

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,

apratim-mishra avatar Jun 29 '22 12:06 apratim-mishra

You have four treatments while the GradientBoostingRegressor that you use for model_t does not support multiple outcomes. You should wrap it with a MultiOutputRegressor.

vsyrgkanis avatar Jun 29 '22 12:06 vsyrgkanis