Package: cramR
Type: Package
Title: Cram Method for Efficient Simultaneous Learning and Evaluation
Version: 0.1.1
Date: 2025-08-17
Authors@R: c(
    person("Yanis", "Vandecasteele", email = "yanisvdc.ensae@gmail.com", role = c("cre", "aut")),
    person("Michael Lingzhi", "Li", email = "mili@hbs.edu", role = "ctb"),
    person("Kosuke", "Imai", email = "imai@harvard.edu", role = "ctb"),
    person("Zeyang", "Jia", email = "zeyangjia@fas.harvard.edu", role = "ctb"),
    person("Longlin", "Wang", email = "longlin_wang@g.harvard.edu", role = "ctb")
  )
Maintainer: Yanis Vandecasteele <yanisvdc.ensae@gmail.com>
Description: 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>.
License: GPL-3
URL: https://github.com/yanisvdc/cramR,
        https://yanisvdc.github.io/cramR/
BugReports: https://github.com/yanisvdc/cramR/issues
Depends: R (>= 3.5.0)
Imports: caret (>= 7.0-1), grf (>= 2.4.0), glmnet (>= 4.1.8), stats (>=
        4.3.3), magrittr (>= 2.0.3), doParallel (>= 1.0.17), foreach
        (>= 1.5.2), DT (>= 0.33), data.table (>= 1.16.4), keras (>=
        2.15.0), dplyr (>= 1.1.4), purrr, R6, rjson, R.devices,
        itertools, iterators
Suggests: testthat (>= 3.0.0), covr (>= 3.5.1), kableExtra (>= 1.4.0),
        profvis (>= 0.4.0), devtools, waldo, knitr, rmarkdown,
        randomForest, gbm, nnet, withr
Encoding: UTF-8
RoxygenNote: 7.3.2
VignetteBuilder: knitr, rmarkdown
Config/testthat/edition: 3
Config/Needs/citation: yes
NeedsCompilation: no
Packaged: 2025-08-17 21:58:52 UTC; yanis
Author: Yanis Vandecasteele [cre, aut],
  Michael Lingzhi Li [ctb],
  Kosuke Imai [ctb],
  Zeyang Jia [ctb],
  Longlin Wang [ctb]
Repository: CRAN
Date/Publication: 2025-08-24 17:40:02 UTC
Built: R 4.7.0; ; 2026-05-07 04:18:49 UTC; windows
