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.69k stars 697 forks source link

ModuleNotFoundError: No module named 'econml.tests' #588

Open advancehs opened 2 years ago

advancehs commented 2 years ago

I tried to run this on my local and Google Colab, both provided the same error.

I am simply trying to run an example in your documentation:

# Main imports
from econml.dynamic.dml import DynamicDML
from econml.tests.dgp import DynamicPanelDGP, add_vlines

# Helper imports
import numpy as np
from sklearn.linear_model import Lasso, LassoCV, LogisticRegression, LogisticRegressionCV, MultiTaskLassoCV
import matplotlib.pyplot as plt

%matplotlib inline

Traceback below:

ModuleNotFoundError                       Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_34972/2185440898.py in <module>
      1 # Main imports
      2 from econml.dynamic.dml import DynamicDML
----> 3 from econml.tests.dgp import DynamicPanelDGP, add_vlines
      4 
      5 # Helper imports

ModuleNotFoundError: No module named 'econml.tests'

Any help would be appreciated.

kbattocchi commented 2 years ago

We don't include our tests module in our published package, it's mainly used for internal testing, so this is by design. However, I see that we do use this in our DynamicDML example notebook, which we should fix so that it can be used directly by anyone who installs our package. For now, the easiest workaround is simply to copy the definitions from here.

Sorry for the inconvenience.

advancehs commented 2 years ago

Thank you very much for your reply.