policytree
policytree: Policy learning via doubly robust empirical welfare maximization over trees - Published in JOSS (2020)
Science Score: 93.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 6 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: arxiv.org, wiley.com, joss.theoj.org -
○Committers with academic emails
-
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
Repository
Policy learning via doubly robust empirical welfare maximization over trees
Basic Info
- Host: GitHub
- Owner: grf-labs
- License: mit
- Language: R
- Default Branch: master
- Homepage: https://grf-labs.github.io/policytree/
- Size: 1.52 MB
Statistics
- Stars: 83
- Watchers: 9
- Forks: 15
- Open Issues: 14
- Releases: 0
Topics
Metadata Files
README.md
policytree
A package for learning simple rule-based policies, where the rule takes the form of a shallow decision tree. Applications include settings which require interpretable predictions, such as for example a medical treatment prescription. This package uses doubly robust reward estimates from grf to find a shallow, but globally optimal decision tree.
Some helpful links for getting started:
- The R package documentation contains usage examples and method references.
- For community questions and answers around usage, see the GitHub issues page.
- The packages fastpolicytree and sparsepolicytree implement modified solvers that may offer improved performance on larger datasets.
Installation
The latest release of the package can be installed through CRAN:
R
install.packages("policytree")
To install the latest development version from source:
R
devtools::install_github("grf-labs/policytree", subdir = "r-package/policytree")
Installing from source requires a C++ 11 compiler (on Windows Rtools is required as well) together with the R packages
Rcpp and BH.
Multi-action policy learning example
```r library(policytree) n <- 250 p <- 10 X <- matrix(rnorm(n * p), n, p) W <- as.factor(sample(c("A", "B", "C"), n, replace = TRUE)) Y <- X[, 1] + X[, 2] * (W == "B") + X[, 3] * (W == "C") + runif(n) multi.forest <- grf::multiarmcausal_forest(X, Y, W)
Compute doubly robust reward estimates.
Gamma.matrix <- doublerobustscores(multi.forest) head(Gamma.matrix)
A B C
1 -0.002612209 -0.1438422 -0.04243015
2 0.417066177 0.4212708 1.04000173
3 2.020414370 0.3963890 1.33038496
4 1.193587749 1.7862142 -0.05668051
5 0.808323778 0.5017521 1.52094053
6 -0.045844471 -0.1460745 -1.56055025
Fit a depth 2 tree on a random training subset.
train <- sample(1:n, 200) opt.tree <- policy_tree(X[train, ], Gamma.matrix[train, ], depth = 2) opt.tree
policy_tree object
Tree depth: 2
Actions: 1: A 2: B 3: C
Variable splits:
(1) splitvariable: X3 splitvalue: 0.368037
(2) splitvariable: X2 splitvalue: -0.098143
(4) * action: 1
(5) * action: 2
(3) splitvariable: X2 splitvalue: 1.25697
(6) * action: 3
(7) * action: 2
Predict treatment on held out data
head(predict(opt.tree, X[-train, ]))
> [1] 2 3 1 2 3 3
```
Details
policy_tree(): fits a depth k tree by exhaustive search (Nxp features on Nxd actions). The optimal tree maximizes the sum of rewards: let $\Gammai \in \mathbb R^d$ be a vector of unit-specific rewards for each action 1 to $d$ and $\pi(Xi) \in \{1, ..., d\}$ a mapping from covariates $Xi$ to action. `policytree` solves the following:
$$ \pi^* = argmax{\pi \in \Pi} \left[\frac{1}{n} \sum{i=1}^{n} \Gammai(\pi(Xi)) \right], $$
where $\Pi$ is the class of depth-k decision trees. (hybrid_policy_tree() employs a mix between a optimal/greedy approach and can be used to fit deeper trees).
double_robust_scores(): computes doubly robust reward estimates for a subset of grf forest types.
Contributing
Contributions are welcome, please consult the development guide for details.
Funding
Development of policytree is supported by the National Science Foundation, the Sloan Foundation, the Office of Naval Research (Grant N00014-17-1-2131) and Schmidt Futures.
References
Susan Athey and Stefan Wager. Policy Learning With Observational Data. Econometrica 89.1 (2021): 133-161. [paper, arxiv]
Toru Kitagawa and Aleksey Tetenov. Who Should be Treated? Empirical Welfare Maximization Methods for Treatment Choice. Econometrica 86.2 (2018): 591-616. [paper]
Erik Sverdrup, Ayush Kanodia, Zhengyuan Zhou, Susan Athey, and Stefan Wager. policytree: Policy learning via doubly robust empirical welfare maximization over trees. Journal of Open Source Software, 5(50), 2020. [paper]
Zhengyuan Zhou, Susan Athey, and Stefan Wager. Offline Multi-Action Policy Learning: Generalization and Optimization. Operations Research 71.1 (2023). [paper, arxiv]
Owner
- Name: GRF Labs
- Login: grf-labs
- Kind: organization
- Location: Stanford University
- Website: https://grf-labs.github.io/grf/
- Repositories: 4
- Profile: https://github.com/grf-labs
JOSS Publication
policytree: Policy learning via doubly robust empirical welfare maximization over trees
Authors
Stanford Graduate School of Business
NYU Stern
Stanford Graduate School of Business
Stanford Graduate School of Business
Tags
causal inference econometricsGitHub Events
Total
- Issues event: 4
- Watch event: 7
- Delete event: 1
- Issue comment event: 4
- Push event: 1
Last Year
- Issues event: 4
- Watch event: 7
- Delete event: 1
- Issue comment event: 4
- Push event: 1
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Erik Sverdrup | e****p@g****m | 161 |
| Stefan Wager | s****r | 4 |
| Ayush Kanodia | k****h@g****m | 4 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 25
- Total pull requests: 86
- Average time to close issues: 4 months
- Average time to close pull requests: 1 day
- Total issue authors: 13
- Total pull request authors: 2
- Average comments per issue: 4.0
- Average comments per pull request: 0.1
- Merged pull requests: 80
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 3
- Pull requests: 0
- Average time to close issues: 6 days
- Average time to close pull requests: N/A
- Issue authors: 3
- Pull request authors: 0
- Average comments per issue: 1.67
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- njawadekar (6)
- erikcs (6)
- hhsievertsen (3)
- gabriel-ruiz (1)
- jkortner (1)
- aczura2024 (1)
- shafayetShafee (1)
- MCKnaus (1)
- beniaminogreen (1)
- jarkki (1)
- ZhiyLiu (1)
- kmrnykgbn (1)
- if-sudo (1)
Pull Request Authors
- erikcs (87)
- kanodiaayush (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- cran 672 last-month
- Total docker downloads: 38
-
Total dependent packages: 1
(may contain duplicates) -
Total dependent repositories: 2
(may contain duplicates) - Total versions: 18
- Total maintainers: 1
cran.r-project.org: policytree
Policy Learning via Doubly Robust Empirical Welfare Maximization over Trees
- Homepage: https://github.com/grf-labs/policytree
- Documentation: http://cran.r-project.org/web/packages/policytree/policytree.pdf
- License: MIT + file LICENSE
-
Latest release: 1.2.3
published over 1 year ago
Rankings
Maintainers (1)
conda-forge.org: r-policytree
- Homepage: https://github.com/grf-labs/policytree
- License: GPL-3.0-only
-
Latest release: 1.2.0
published almost 4 years ago
Rankings
Dependencies
- R >= 3.5.0 depends
- Rcpp * imports
- grf >= 2.0.0 imports
- DiagrammeR * suggests
- testthat >= 3.0.4 suggests
