diff --git a/README.md b/README.md index c79886e67..c1c0396e1 100644 --- a/README.md +++ b/README.md @@ -502,6 +502,47 @@ as p-values and z-statistics. When the CATE model is linear and parametric, then + +### Policy Learning + +You can also perform direct policy learning from observational data, using the doubly robust method for offline +policy learning. These methods directly predict a recommended treatment, without internally fitting an explicit +model of the conditional average treatment effect. + +
+ Doubly Robust Policy Learning (click to expand) + +```Python +from econml.policy import DRPolicyTree, DRPolicyForest +from sklearn.ensemble import RandomForestRegressor + +# fit a single binary decision tree policy +policy = DRPolicyTree(max_depth=1, min_impurity_decrease=0.01, honest=True) +policy.fit(y, T, X=X, W=W) +# predict the recommended treatment +recommended_T = policy.predict(X) +# plot the binary decision tree +plt.figure(figsize=(10,5)) +policy.plot() +# get feature importances +importances = policy.feature_importances_ + +# fit a binary decision forest +policy = DRPolicyForest(max_depth=1, min_impurity_decrease=0.01, honest=True) +policy.fit(y, T, X=X, W=W) +# predict the recommended treatment +recommended_T = policy.predict(X) +# plot the first tree in the ensemble +plt.figure(figsize=(10,5)) +policy.plot(0) +# get feature importances +importances = policy.feature_importances_ +``` + + + ![image](images/policy_tree.png) +
+ 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/). # For Developers @@ -569,6 +610,10 @@ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additio # References +Athey, Susan, and Stefan Wager. +**Policy learning with observational data.** +Econometrica 89.1 (2021): 133-161. + X Nie, S Wager. **Quasi-Oracle Estimation of Heterogeneous Treatment Effects.** [*Biometrika*](https://doi.org/10.1093/biomet/asaa076), 2020 @@ -606,3 +651,7 @@ S. Wager, S. Athey. 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, ICML'17*](http://proceedings.mlr.press/v70/hartford17a/hartford17a.pdf), 2017. V. Chernozhukov, D. Chetverikov, M. Demirer, E. Duflo, C. Hansen, and a. W. Newey. **Double Machine Learning for Treatment and Causal Parameters.** [*ArXiv preprint arXiv:1608.00060*](https://arxiv.org/abs/1608.00060), 2016. + +Dudik, M., Erhan, D., Langford, J., & Li, L. +**Doubly robust policy evaluation and optimization.** +Statistical Science, 29(4), 485-511, 2014. \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 56afea596..05c9eb61d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -36,6 +36,7 @@ jobs: switch -Wildcard ($file) { "README.md" { Continue } "prototypes/*" { Continue } + "images/*" { Continue } "doc/*" { $docChanges = $true; Continue } "notebooks/*" { $nbChanges = $true; Continue } default { $codeChanges = $true; Continue } diff --git a/images/policy_tree.png b/images/policy_tree.png new file mode 100644 index 000000000..d9157c260 Binary files /dev/null and b/images/policy_tree.png differ