Skip to content

Commit 6f459e1

Browse files
author
Miruna Oprescu
authored
Update README.md (#77)
* Update README.md Reflect code changes, update references and publication sections. * Updated docs * Fixed reference. * Updated bootstrap example
1 parent ec189d6 commit 6f459e1

File tree

6 files changed

+44
-39
lines changed

6 files changed

+44
-39
lines changed

README.md

+29-24
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ consult the documentation at https://econml.azurewebsites.net/.
2323
<details>
2424
<summary><strong><em>Table of Contents</em></strong></summary>
2525

26-
- [Introduction](#introduction)
27-
- [About Treatment Effect Estimation](#about-treatment-effect-estimation)
28-
- [Example Applications](#example-applications)
29-
- [News](#news)
30-
- [Getting Started](#getting-started)
31-
- [Installation](#installation)
32-
- [Usage Examples](#usage-examples)
33-
- [For Developers](#for-developers)
34-
- [Running the tests](#running-the-tests)
35-
- [Generating the documentation](#generating-the-documentation)
36-
- [Blogs and Publications](#blogs-and-publications)
37-
- [Contributing and Feedback](#contributing-and-feedback)
38-
- [References](#references)
26+
- [Introduction](#Introduction)
27+
- [About Treatment Effect Estimation](#About-Treatment-Effect-Estimation)
28+
- [Example Applications](#Example-Applications)
29+
- [News](#News)
30+
- [Getting Started](#Getting-Started)
31+
- [Installation](#Installation)
32+
- [Usage Examples](#Usage-Examples)
33+
- [For Developers](#For-Developers)
34+
- [Running the tests](#Running-the-tests)
35+
- [Generating the documentation](#Generating-the-documentation)
36+
- [Blogs and Publications](#Blogs-and-Publications)
37+
- [Contributing and Feedback](#Contributing-and-Feedback)
38+
- [References](#References)
3939

4040
</details>
4141

@@ -113,9 +113,9 @@ To install from source, see [For Developers](#for-developers) section below.
113113
from econml.dml import DMLCateEstimator
114114
from sklearn.linear_model import LassoCV
115115

116-
est = DMLCateEstimator(model_y=LassoCV(), model_t=LassoCV)
116+
est = DMLCateEstimator(model_y=LassoCV(), model_t=LassoCV())
117117
est.fit(Y, T, X, W) # W -> high-dimensional confounders, X -> features
118-
treatment_effects = est.const_marginal_effect(X_test)
118+
treatment_effects = est.effect(X_test)
119119
```
120120

121121
* [Orthogonal Random Forests](#references)
@@ -130,7 +130,7 @@ To install from source, see [For Developers](#for-developers) section below.
130130
model_T=LassoCV(cv=3), model_Y=LassoCV(cv=3)
131131
)
132132
est.fit(Y, T, X, W)
133-
treatment_effects = est.const_marginal_effect(X_test)
133+
treatment_effects = est.effect(X_test)
134134
```
135135

136136
* [Deep Instrumental Variables](#references)
@@ -164,12 +164,11 @@ To install from source, see [For Developers](#for-developers) section below.
164164

165165
* Bootstrap Confidence Intervals
166166
```Python
167-
from econml.bootstrap import BootstrapEstimator
168-
169-
# Bootstrap estimator wrapper
170-
boot_est = BootstrapEstimator(est, n_bootstrap_samples=10)
171-
boot_est.fit(Y, T, X, W)
172-
treatment_effect_interval = boot_est.const_marginal_effect_interval(X_test, lower=1, upper=99)
167+
from econml.dml import DMLCateEstimator
168+
169+
est = DMLCateEstimator(model_y=LassoCV(), model_t=LassoCV(), inference='bootstrap')
170+
est.fit(Y, T, X, W)
171+
treatment_effect_interval = est.effect_interval(X_test, lower=1, upper=99)
173172
```
174173

175174
To see more complex examples, go to the [notebooks](https://github.com/Microsoft/EconML/tree/master/notebooks) section of the repository. For a more detailed description of the treatment effect estimation algorithms, see the EconML [documentation](https://econml.azurewebsites.net/).
@@ -196,9 +195,11 @@ The reStructuredText files that make up the documentation are stored in the [doc
196195

197196
# Blogs and Publications
198197

198+
* June 2019: [Treatment Effects with Instruments paper](https://arxiv.org/pdf/1905.10176.pdf)
199+
199200
* May 2019: [Open Data Science Conference Workshop](https://staging5.odsc.com/training/portfolio/machine-learning-estimation-of-heterogeneous-treatment-effect-the-microsoft-econml-library)
200201

201-
* 2018: [Orthogonal Random Forests paper](https://arxiv.org/abs/1806.03467)
202+
* 2018: [Orthogonal Random Forests paper](http://proceedings.mlr.press/v97/oprescu19a.html)
202203

203204
* 2017: [DeepIV paper](http://proceedings.mlr.press/v70/hartford17a/hartford17a.pdf)
204205

@@ -218,9 +219,13 @@ contact [[email protected]](mailto:[email protected]) with any additio
218219

219220
# References
220221

222+
V. Syrgkanis, V. Lei, M. Oprescu, M. Hei, K. Battocchi, G. Lewis.
223+
**Machine Learning Estimation of Heterogeneous Treatment Effects with Instruments**
224+
[*ArXiv preprint arXiv:1905.10176*](https://arxiv.org/abs/1905.10176)
225+
221226
M. Oprescu, V. Syrgkanis and Z. S. Wu.
222227
**Orthogonal Random Forest for Causal Inference.**
223-
[*ArXiv preprint arXiv:1806.03467*](http://arxiv.org/abs/1806.03467), 2018.
228+
[*Proceedings of the 36th International Conference on Machine Learning*](http://proceedings.mlr.press/v97/oprescu19a.html), 2019.
224229

225230
Jason Hartford, Greg Lewis, Kevin Leyton-Brown, and Matt Taddy. **Deep IV: A flexible approach for counterfactual prediction.** [*Proceedings of the 34th International Conference on Machine Learning*](http://proceedings.mlr.press/v70/hartford17a/hartford17a.pdf), 2017.
226231

doc/spec/estimation/dml.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ matrix of cross price elasticities as:
311311
est.fit(Y, T, None, W)
312312
313313
# a_hat[i,j] contains the elasticity of the demand of product i on the price of product j
314-
a_hat = est.const_marginal_effect()
314+
a_hat = est.effect()
315315
316316
If we have too many products then the cross-price elasticity matrix contains many parameters and we need
317317
to regularize. Given that we want to estimate a matrix, it makes sense in this application to consider
@@ -335,7 +335,7 @@ lightning package implements such a class:
335335
model_final=FistaRegressor(penalty='trace', C=0.0001),
336336
featurizer=PolynomialFeatures(degree=1, include_bias=False))
337337
est.fit(Y, T, X, W)
338-
te_pred = est.const_marginal_effect(np.array([[np.median(X)]]))
338+
te_pred = est.effect(np.array([[np.median(X)]]))
339339
print(te_pred)
340340
print(np.linalg.svd(te_pred[0]))
341341
@@ -350,9 +350,9 @@ Similarly we can get heterogeneous cross-price elasticities with respect to some
350350
est.fit(Y, T, X, W)
351351
352352
# est.coef(1) contains the cross-price elasticities when X=1, i.e. during christmas.
353-
a_christmas = est.const_marginal_effect([[1]])
353+
a_christmas = est.effect([[1]])
354354
# Similarly est.coef(0) contains the cross price elasticities when it is not christmas.
355-
a_non_christmas = est.const_marginal_effect([[0]])
355+
a_non_christmas = est.effect([[0]])
356356
357357
We can create even more complex conditional statements, such as store specific elasticities during christmas:
358358

@@ -365,7 +365,7 @@ We can create even more complex conditional statements, such as store specific e
365365
est.fit(Y, T, X, W)
366366
367367
# est.coef(1, 1) contains the cross-price elasticities in the online store during christmas.
368-
a_christmas = est.const_marginal_effect([[1, 1]])
368+
a_christmas = est.effect([[1, 1]])
369369
# est.coef(0, 1) contains the cross price elasticities in the online store
370370
# when it is not christmas, etc.
371371
a_non_christmas = est.const_marginal_effect([[0, 1]])

doc/spec/estimation/forest.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Forest Based Estimators
66
Orthogonal Random Forests
77
-------------------------
88

9-
Orthogonal Random Forests [Oprescu2018]_ are a combination of causal forests and double machine learning that allow
9+
Orthogonal Random Forests [Oprescu2019]_ are a combination of causal forests and double machine learning that allow
1010
for controlling for a high-dimensional set of confounders :math:`W`, while at the same time estimating non-parametrically
1111
the heterogeneous treatment effect :math:`\theta(X)`, on a lower dimensional set of variables :math:`X`.
1212
Moreover, the estimates are asymptotically normal and hence have theoretical properties
@@ -69,7 +69,7 @@ first approach is applicable.
6969

7070
In the case of discrete treatments (see :py:class:`~econml.ortho_forest.DiscreteTreatmentOrthoForest`) the
7171
method estimates :math:`\theta(x)` for some target :math:`x` by solving a slightly different
72-
set of equations (see [Oprescu2018]_ for a theoretical exposition of why a different set of
72+
set of equations (see [Oprescu2019]_ for a theoretical exposition of why a different set of
7373
estimating equations is used). In particular, suppose that the treatment :math:`T` takes
7474
values in :math:`\{0, 1, \ldots, k\}`, then to estimate the treatment effect :math:`\theta_t(x)` of
7575
treatment :math:`t` as compared to treatment :math:`0`, the method finds the solution to the
@@ -113,7 +113,7 @@ and what the returned values correspond to in a simple data generating process:
113113
... model_T=sklearn.linear_model.LinearRegression(),
114114
... model_Y=sklearn.linear_model.LinearRegression())
115115
>>> est.fit(Y, T, W, W)
116-
>>> print(est.const_marginal_effect(W[:2]))
116+
>>> print(est.effect(W[:2]))
117117
[[1. ]
118118
[1.2]]
119119

@@ -126,7 +126,7 @@ Similarly, we can call :py:class:`~econml.ortho_forest.DiscreteTreatmentOrthoFor
126126
... propensity_model=sklearn.linear_model.LogisticRegression(),
127127
... model_Y=sklearn.linear_model.LinearRegression())
128128
>>> est.fit(Y, T, W, W)
129-
>>> print(est.const_marginal_effect(W[:2]))
129+
>>> print(est.effect(W[:2]))
130130
[[1. ]
131131
[1.2]]
132132

@@ -143,7 +143,7 @@ both the treatment and the outcome regressions, in the case of continuous treatm
143143
>>> est = ContinuousTreatmentOrthoForest()
144144
>>> est.fit(Y, T, X, W)
145145
>>> X_test = np.linspace(-1, 1, 30).reshape(-1, 1)
146-
>>> treatment_effects = est.const_marginal_effect(X_test)
146+
>>> treatment_effects = est.effect(X_test)
147147
>>> plt.plot(X_test, y, label='ORF estimate')
148148
>>> plt.plot(X_test[:, 0], np.exp(2*X_test[:, 0]), 'b--', label='True effect')
149149
>>> plt.legend()

doc/spec/motivation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ It implements techniques from recent academic works, several of which produced i
2121
the ALICE project of Microsoft Research, and many others from leading groups in the field.
2222
Examples include Double Machine Learning (see e.g. [Chernozhukov2016]_, [Chernozhukov2017]_,
2323
[Mackey2017]_, [Nie2017]_, [Chernozhukov2018]_, [Foster2019]_), Causal Forests (see e.g. [Wager2018]_, [Athey2019]_
24-
[Oprescu2018]_),
24+
[Oprescu2019]_),
2525
Deep Instrumental Variables (see e.g. [Hartford2017]_), Non-parametric Instrumental Variables [Newey2003]_,
2626
meta-learners (see e.g. [Kunzel2017]_).
2727
The library brings together all these diverse techniques under a common

doc/spec/references.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ References
6262
Generalized Random Forests.
6363
*Annals of Statistics*, 2019
6464
65-
.. [Oprescu2018]
65+
.. [Oprescu2019]
6666
M. Oprescu, V. Syrgkanis and Z. S. Wu.
6767
Orthogonal Random Forest for Causal Inference.
68-
*arXiv preprint arXiv:1806.03467*, 2018.
69-
URL http://arxiv.org/abs/1806.03467.
68+
*Proceedings of the 36th International Conference on Machine Learning*, 2019.
69+
URL http://proceedings.mlr.press/v97/oprescu19a.html.
7070
7171
.. [Nie2017]
7272
X. Nie and S. Wager.

econml/ortho_forest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
- The `DiscreteTreatmentOrthoForest`, a two-forest approach for learning discrete treatment effects
1818
using kernel two stage estimation.
1919
20-
For more details on these methods, see our paper [Oprescu2018]_.
20+
For more details on these methods, see our paper [Oprescu2019]_.
2121
"""
2222

2323
import abc

0 commit comments

Comments
 (0)