Cram Method for Efficient Simultaneous Learning and Evaluation
Overview
Performs the Cram method, a general and efficient approach to simultaneous learning and evaluation using a generic machine learning algorithm. In a single pass of batched data, the proposed method repeatedly trains a machine learning algorithm and tests its empirical performance. Because it utilizes the entire sample for both learning and evaluation, cramming is significantly more data-efficient than sample-splitting. Unlike cross-validation, Cram evaluates the final learned model directly, providing sharper inference aligned with real-world deployment. The method naturally applies to both policy learning and contextual bandits, where decisions are based on individual features to maximize outcomes. The package includes cram_policy() for learning and evaluating individualized binary treatment rules, cram_ml() to train and assess the population-level performance of machine learning models, and cram_bandit() for on-policy evaluation of contextual bandit algorithms. For all three functions, the package provides estimates of the average outcome that would result if the model were deployed, along with standard errors and confidence intervals for these estimates. Details of the method are described in Jia, Imai, and Li (2024) https://www.hbs.edu/ris/Publication%20Files/2403.07031v1_a83462e0-145b-4675-99d5-9754aa65d786.pdf and Jia et al. (2025) doi:10.48550/arXiv.2403.07031.
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-06-09
- ERROR12 OK, 1 ERROR2026-06-08
- OK13 OK2026-05-02
Show 4 earlier changesHide 4 earlier changes
- ERROR11 OK, 1 ERROR2026-04-25
- NOTE11 OK, 3 NOTE2026-04-01
- ERROR10 OK, 3 NOTE, 1 ERROR2026-03-30
- NOTE11 OK, 3 NOTE2026-03-10
Documentation
- Help pages
- 30
- Examples that run
- 60%3 run in a plain check · 2 only when donttest examples are enabled (R CMD check --as-cran)
- Exported functions with examples
- 17%
- Documented parameters
- 100%
- Return-value docs
- 83%
- Help pages citing references
- 0%
- Cram Bandit HTML
- Cram Bandit Helpers HTML
- Cram Bandit Simulation HTML
- Cram ML HTML
- Cram Policy part 2 HTML
- Cram Policy Simulation HTML
- Introduction & Cram Policy part 1 HTML
- Quick Start with CRAM HTML
Downloads
Repository
Stars over time
3 development-tooling and community-health practices detected across 2 families in the upstream repository
Checks run against github.com/yanisvdc/cramr on 2026-10-11.
GitHub Pages site last deployed 2025-05-15
pkgdown site last built 2025-05-15, before release 0.1.1 (2025-08-24)
Dependencies
Installing cramR adds 120 packages (60 with compiled code, 87 MB of source tarballs). Heaviest: stringi 11 MB, ggplot2 6.0 MB, data.table 5.7 MB.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- RR 4.6.0 released · 2026-04-24
- 0.1.1Latest
- 0.1.02025-05-14
- RR 4.5.0 released · 2025-04-11
Package metadata
- First published
- 2025-05-14
- Total releases
- 2 / 1 yrs
- License
- GPL-3 OSI
- Minimum R
- ≥ 3.5.0
- Download size
- 3.6 MB
Cite
Cite this package
Run in R for the authors' entry:
citation("cramR")The package provides a citation file, so citation() returns the authors' own entry.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-18, which the citation names so these numbers can be found later. More on citing and the projects behind them.