Utility functions for cvo object. More in section "Details."

cvo_get_inds(cvo, fold, type = c("asis", "train", "test"))

# S3 method for cvo_caret
cvo_get_inds(cvo, fold, type = c("asis", "train", "test"))

# S3 method for cvo_mlr
cvo_get_inds(cvo, fold, type = c("asis", "train", "test"))

cvo_get_info(cvo)

cvo_get_sample_size(cvo)

cvo_get_seeds(cvo)

cvo_count_folds(cvo)

# S3 method for cvo_caret
cvo_count_folds(cvo)

# S3 method for cvo_mlr
cvo_count_folds(cvo)

cvo_get_fold_names(cvo)

# S3 method for cvo_caret
cvo_get_fold_names(cvo)

# S3 method for cvo_mlr
cvo_get_fold_names(cvo)

Arguments

cvo

a cross-validation object (cvo) created with function cvo_create_folds.

fold

either a name or an index of fold of interest.

type

(string) one of options, indicating the kind of indices you are interested in:

  • "AsIs" - indices as they are in the object,

  • "Train" - indices of training set,

  • "Test" - indices of test set.

Details

Function cvo_get_info returns information about the cross-validation object cvo.

Function cvo_get_sample_size returns sample size of the object used to create the cross-validation object cvo.

Function cvo_count_folds returns total number of folds in a cvo object.

Function cvo_get_inds extracts indices of indicated set (either training or test) from cross-validation object (cvo) created with function cvo_create_folds when fold of interest is indicated as fold (it can be either a name of fold or an index of fold). If cvo does not contain indices of chosen type, it returns a complement to those indices and this information is indicated in attributes of returned object.

Function cvo_get_seeds returns information about seeds of (pseudo)random number generator used for each repetition of splitting to folds.

See also

Examples

cvo <- cvo_create_folds(fluorescence, folds = 10) cvo
#> --- A cvo object: ---------------------------------------------------- #> indices stratified blocked cv_type k repetitions sample_size #> Train FALSE FALSE k-fold 10 1 150 #> ----------------------------------------------------------------------
cvo_get_info(cvo)
#> indices stratified blocked cv_type k repetitions sample_size #> 1 Train FALSE FALSE k-fold 10 1 150
cvo_get_seeds(cvo)
#> $generator #> NULL #> #> $seeds #> NULL #>
cvo_get_sample_size(cvo)
#> [1] 150
cvo_count_folds(cvo)
#> [1] 10
cvo_get_fold_names(cvo)
#> [1] "Rep1_Fold01" "Rep1_Fold02" "Rep1_Fold03" "Rep1_Fold04" "Rep1_Fold05" #> [6] "Rep1_Fold06" "Rep1_Fold07" "Rep1_Fold08" "Rep1_Fold09" "Rep1_Fold10"
cvo_get_inds(cvo, 1)
#> [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 16 17 20 21 22 #> [19] 23 24 25 26 28 29 30 31 32 33 34 36 37 38 39 40 41 42 #> [37] 43 44 45 46 47 48 49 51 52 53 54 55 57 58 59 61 62 63 #> [55] 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 81 82 #> [73] 84 86 87 88 89 90 91 92 94 95 96 97 98 99 100 101 102 104 #> [91] 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 #> [109] 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 141 #> [127] 142 143 144 145 146 147 148 149 150 #> attr(,"fold") #> [1] "Rep1_Fold01" #> attr(,"indices") #> [1] "Train"
cvo_get_inds(cvo, 1, "train")
#> [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 16 17 20 21 22 #> [19] 23 24 25 26 28 29 30 31 32 33 34 36 37 38 39 40 41 42 #> [37] 43 44 45 46 47 48 49 51 52 53 54 55 57 58 59 61 62 63 #> [55] 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 81 82 #> [73] 84 86 87 88 89 90 91 92 94 95 96 97 98 99 100 101 102 104 #> [91] 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 #> [109] 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 141 #> [127] 142 143 144 145 146 147 148 149 150 #> attr(,"fold") #> [1] "Rep1_Fold01" #> attr(,"indices") #> [1] "train"
cvo_get_inds(cvo, 1, "test")
#> [1] 1 15 18 19 27 35 50 56 60 80 83 85 93 103 140 #> attr(,"fold") #> [1] "Rep1_Fold01" #> attr(,"indices") #> [1] "Complement to Train"