X-Git-Url: https://git.auder.net/?p=agghoo.git;a=blobdiff_plain;f=R%2Futils.R;h=823b123c1b41d3c0d8d69f53d0be89252bea59d1;hp=fa3a9dfc43e3e547ee2281841294e80fee1093c3;hb=17ea2f13e0c32c107db20677750bd7a98bb7e0f8;hpb=afa676609daba103e43d6d4654560ca4c1c9b38b diff --git a/R/utils.R b/R/utils.R index fa3a9df..823b123 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1,3 +1,4 @@ +# Helper for cross-validation: return the next test indices. get_testIndices <- function(n, CV, v, shuffle_inds) { if (CV$type == "vfold") { # Slice indices (optionnally shuffled) @@ -13,6 +14,7 @@ get_testIndices <- function(n, CV, v, shuffle_inds) { test_indices } +# Helper which split data into training and testing parts. splitTrainTest <- function(data, target, testIdx) { dataTrain <- data[-testIdx,] targetTrain <- target[-testIdx]