Skip to contents

Train + assess across resampling folds and combine the results

Usage

morie_ml_resample(
  model,
  x,
  y,
  n_folds = 5L,
  metric = if (model$type == "logistic") "roc_auc" else "rmse",
  seed = 42L
)

Arguments

model

A morie_ml_model.

x

Predictors.

y

Response.

n_folds

Number of folds (default 5). Data is partitioned so each observation is used for testing exactly once (ML4.8).

metric

Metric to report per fold.

seed

RNG seed.

Value

A list with per-fold scores and their mean/sd.

Examples

morie_ml_resample(morie_ml_model("linear", "gd", epochs = 50),
                  mtcars[c("hp", "wt")], mtcars$mpg, n_folds = 3)$mean
#> [1] 2.761972