Skip to content

yanisvdc/cramR

Repository files navigation

CRAM Logo

The Cram Method for Efficient Simultaneous Learning and Evaluation

View on GitHub Report a Bug Read Paper


📚 What is CRAM?

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.


🎯 Key Features

  • 🧠 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 (via caret 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.


📚 Documentation


🛠️ Installation

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")

📄 Citation & 🤝 Contributing

📚 Citation

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}
}

🤝 How to Contribute

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

📧 Contact

For questions or issues, please open an issue.

About

No description, website, or topics provided.

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages