py-why / EconML

ALICE (Automated Learning and Intelligence for Causation and Economics) is a Microsoft Research project aimed at applying Artificial Intelligence concepts to economic decision making. One of its goals is to build a toolkit that combines state-of-the-art machine learning techniques with econometrics in order to bring automation to complex causal inference problems. To date, the ALICE Python SDK (econml) implements orthogonal machine learning algorithms such as the double machine learning work of Chernozhukov et al. This toolkit is designed to measure the causal effect of some treatment variable(s) t on an outcome variable y, controlling for a set of features x.
https://www.microsoft.com/en-us/research/project/alice/
Other
3.77k stars 713 forks source link

dowhy is no longer a dependency of the main econml package #789

Open Yif18 opened 1 year ago

Yif18 commented 1 year ago

import dowhy import econml.dowhy

est = LinearDML(model_y=GradientBoostingRegressor(), model_t=GradientBoostingRegressor(), featurizer=PolynomialFeatures(degree=2, include_bias=False)) est_dw = est.dowhy.fit(Y, T, X=X, W=W, outcome_names=["log_demand"], treatment_names=["log_price"], feature_names=["income"], confounder_names=confounder_names, inference="statsmodels")

ImportError: dowhy is no longer a dependency of the main econml package; install econml[dowhy] or econml[all] to require it, or install dowhy separately to use dowhy from econml

kbattocchi commented 1 year ago

This is by design; as the error message indicates, if you'd like to use the integrated dowhy functionality you should install the dowhy extra (pip install econml[dowhy]), not only the base econml package.

Is there something that we could change about the error message or documentation to make this more clear?

Yif18 commented 1 year ago

This is by design; as the error message indicates, if you'd like to use the integrated dowhy functionality you should install the dowhy extra (pip install econml[dowhy]), not only the base econml package.

Is there something that we could change about the error message or documentation to make this more clear?

i have installed econml[dowhy] and dowhy,but the error still exists,I found that this error is related to the Python version, and it occurs when I use the latest version of Python(3.10.9)

titubs commented 1 year ago

@kbattocchi I am getting the same error despite trying the pip installs you mentioned. Can you clarify?

kbattocchi commented 1 year ago

@titubs Could you include both the full stack trace as well as the output of pip list?

I suspect the issue is actually that either import dowhy or from dowhy import CausalModel is throwing an exception, which we interpret as dowhy not being installed, but which could be caused by some other issue internal to the dowhy package. Could you try running just those two lines in an interpreter and see if you get an error message when you do?