Skip to content

Commit 056fb30

Browse files
authored
addeed policy learning to readme (#440)
* addeed policy learning to readme
1 parent 4572bda commit 056fb30

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,47 @@ as p-values and z-statistics. When the CATE model is linear and parametric, then
502502

503503
</details>
504504

505+
506+
### Policy Learning
507+
508+
You can also perform direct policy learning from observational data, using the doubly robust method for offline
509+
policy learning. These methods directly predict a recommended treatment, without internally fitting an explicit
510+
model of the conditional average treatment effect.
511+
512+
<details>
513+
<summary>Doubly Robust Policy Learning (click to expand)</summary>
514+
515+
```Python
516+
from econml.policy import DRPolicyTree, DRPolicyForest
517+
from sklearn.ensemble import RandomForestRegressor
518+
519+
# fit a single binary decision tree policy
520+
policy = DRPolicyTree(max_depth=1, min_impurity_decrease=0.01, honest=True)
521+
policy.fit(y, T, X=X, W=W)
522+
# predict the recommended treatment
523+
recommended_T = policy.predict(X)
524+
# plot the binary decision tree
525+
plt.figure(figsize=(10,5))
526+
policy.plot()
527+
# get feature importances
528+
importances = policy.feature_importances_
529+
530+
# fit a binary decision forest
531+
policy = DRPolicyForest(max_depth=1, min_impurity_decrease=0.01, honest=True)
532+
policy.fit(y, T, X=X, W=W)
533+
# predict the recommended treatment
534+
recommended_T = policy.predict(X)
535+
# plot the first tree in the ensemble
536+
plt.figure(figsize=(10,5))
537+
policy.plot(0)
538+
# get feature importances
539+
importances = policy.feature_importances_
540+
```
541+
542+
543+
![image](images/policy_tree.png)
544+
</details>
545+
505546
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/).
506547

507548
# For Developers
@@ -569,6 +610,10 @@ contact [[email protected]](mailto:[email protected]) with any additio
569610

570611
# References
571612

613+
Athey, Susan, and Stefan Wager.
614+
**Policy learning with observational data.**
615+
Econometrica 89.1 (2021): 133-161.
616+
572617
X Nie, S Wager.
573618
**Quasi-Oracle Estimation of Heterogeneous Treatment Effects.**
574619
[*Biometrika*](https://doi.org/10.1093/biomet/asaa076), 2020
@@ -606,3 +651,7 @@ S. Wager, S. Athey.
606651
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.
607652

608653
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.
654+
655+
Dudik, M., Erhan, D., Langford, J., & Li, L.
656+
**Doubly robust policy evaluation and optimization.**
657+
Statistical Science, 29(4), 485-511, 2014.

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
switch -Wildcard ($file) {
3737
"README.md" { Continue }
3838
"prototypes/*" { Continue }
39+
"images/*" { Continue }
3940
"doc/*" { $docChanges = $true; Continue }
4041
"notebooks/*" { $nbChanges = $true; Continue }
4142
default { $codeChanges = $true; Continue }

images/policy_tree.png

28.7 KB
Loading

0 commit comments

Comments
 (0)