Skip to contents

K-fold partition plus CV score (Geron Ch 2, morie.fn hmkfd)

Usage

morie_geron_kfold(
  X,
  y,
  k,
  seed = NULL,
  fit = NULL,
  predict = NULL,
  score = NULL
)

Arguments

X, y

Data.

k

Folds.

seed

Optional shuffle seed.

fit, predict, score

Optional callables.

Value

List with cv_score, fold_scores, train_indices, test_indices, fold_sizes, estimate, n, method.

Examples

morie_geron_kfold(X = c(1, 2, 3, 4, 5, 6, 7, 8), y = c(1, 2, 3, 4, 5, 6, 7, 8), k = 3L)
#> $cv_score
#> [1] 1
#> 
#> $fold_scores
#> [1] 1 1 1
#> 
#> $fold_sizes
#> [1] 3 3 2
#> 
#> $se
#> [1] 0
#> 
#> $train_indices
#> $train_indices[[1]]
#> [1] 4 5 6 7 8
#> 
#> $train_indices[[2]]
#> [1] 1 2 3 7 8
#> 
#> $train_indices[[3]]
#> [1] 1 2 3 4 5 6
#> 
#> 
#> $test_indices
#> $test_indices[[1]]
#> [1] 1 2 3
#> 
#> $test_indices[[2]]
#> [1] 4 5 6
#> 
#> $test_indices[[3]]
#> [1] 7 8
#> 
#> 
#> $K
#> [1] 3
#> 
#> $estimate
#> [1] 1
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "K-fold partition and cross-validated score"
#>