The CRAM method is a powerful approach for simultaneously learning and evaluating decision rules—such as individualized treatment rules (ITRs)—from data. It is particularly relevant in high-stakes applications where decisions must be both personalized and justified.
Common examples include:
- Healthcare: determining who should receive treatment based on individual characteristics
- Advertising and pricing: setting optimal prices to maximize revenue
- Policy interventions: deciding which individuals or regions should receive targeted support to improve outcomes
Unlike traditional approaches like sample splitting or cross-validation, which reserve a portion of the data purely for evaluation, CRAM reuses all available data efficiently during both training and evaluation.
A key distinction from cross-validation is that CRAM evaluates the final learned model directly, rather than averaging the performance of multiple models trained on different data subsets—resulting in sharper inference and better alignment with real-world deployment.
-
🧠 Cram Policy (
cram_policy
): Learn and evaluate individualized binary treatment rules using CRAM. Offers flexible model choices, including causal forests and custom learners. -
📈 Cram ML (
cram_ml
): Learn and evaluate ML models using CRAM. Supports flexible model training (viacaret
or user-defined functions) and custom loss functions. -
🎰 Cram Bandit (
cram_bandit
): Learn and perform on-policy evaluation of contextual bandit algorithms using CRAM. Supports both real data and simulation environments with built-in policies.
To install the development version of CRAM from GitHub:
# Install devtools if needed
install.packages("devtools")
# Install cramR from GitHub
devtools::install_github("yanisvdc/cramR")
If you use CRAM in your research, please cite the following paper:
@article{jia2024cram,
title={The Cram Method for Efficient Simultaneous Learning and Evaluation},
author={Jia, Zeyang and Imai, Kosuke and Li, Michael Lingzhi},
journal={arXiv preprint arXiv:2403.07031},
year={2024}
}
You can also cite the R package:
@Manual{,
title = {cramR: The Cram Method for Efficient Simultaneous Learning and Evaluation},
author = {Yanis Vandecasteele and Michael Lingzhi Li and Kosuke Imai and Zeyang Jia and Longlin Wang},
year = {2025},
note = {R package version 0.1.0},
url = {https://github.com/yanisvdc/cramR}
}
We welcome contributions! To contribute:
# 1. Fork the repository.
# 2. Create a new branch
git checkout -b feature/your-feature
# 3. Commit your changes
git commit -am 'Add some feature'
# 4. Push to the branch
git push origin feature/your-feature
# 5. Create a pull request.
# 6. Open an Issue or PR at:
# https://github.com/yanisvdc/cramR/issues
For questions or issues, please open an issue.