Skip to contents

Repeats .boot_cross_validate() n_repeats times with different RNG seeds and pools the per-fold scores. caret::trainControl(method = "repeatedcv") and rsample::vfold_cv both implement the same partitioning (cross-referenced).

Usage

repeated_cv(
  X,
  y,
  model_fn,
  score_fn,
  n_folds = 10L,
  n_repeats = 10L,
  seed = 42L
)

Arguments

X

Numeric matrix or data.frame of predictors.

y

Numeric or factor outcome vector aligned with rows of X.

model_fn

Function (X, y) -> fitted-model used on each training fold.

score_fn

Function (y_true, y_pred) -> numeric returning a single performance metric.

n_folds

Integer; number of folds per repeat (default 10).

n_repeats

Number of repetitions.

seed

Integer RNG seed for reproducibility.

Value

A morie_cv_result pooling scores across repeats.