split_dataset() randomly assigns floor(prop * nrow(dataset)) rows to a
training set and the rest to a validation set, for example to get the
trainset and valset that compile() takes.
See also
Other optimizer building blocks:
TrialLog,
complete_trial(),
create_trial(),
eval_program(),
load_trial_log(),
optimizer_control(),
read_trials_jsonl(),
sample_dataset(),
write_trials_jsonl()
Examples
df <- data.frame(x = 1:10)
split <- split_dataset(df, prop = 0.8, seed = 42)
nrow(split$train)
#> [1] 8
split$val
#> x
#> 3 3
#> 7 7