-
Notifications
You must be signed in to change notification settings - Fork 725
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
addeed policy learning to readme (#440)
* addeed policy learning to readme
- Loading branch information
1 parent
4572bda
commit 056fb30
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -502,6 +502,47 @@ as p-values and z-statistics. When the CATE model is linear and parametric, then | |
|
||
</details> | ||
|
||
|
||
### 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. | ||
|
||
<details> | ||
<summary>Doubly Robust Policy Learning (click to expand)</summary> | ||
|
||
```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) | ||
</details> | ||
|
||
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 [[email protected]](mailto:[email protected]) 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.