Model evaluation starts by separating rows used for fitting from rows saved for checking predictions.

Program

Play the script to move the holdout boundary and watch the train/test counts change.

holdout_split.R
ids <- 1:6
test_start <- 
train_ids <- ids[ids < test_start]
test_ids <- ids[ids >= test_start]
label <- paste(length(train_ids), length(test_ids), sep = ":")
cat(label, "\n", sep = "")
ids <- 1:6
test_start <- 
train_ids <- ids[ids < test_start]
test_ids <- ids[ids >= test_start]
label <- paste(length(train_ids), length(test_ids), sep = ":")
cat(label, "\n", sep = "")
ids <- 1:6
test_start <- 
train_ids <- ids[ids < test_start]
test_ids <- ids[ids >= test_start]
label <- paste(length(train_ids), length(test_ids), sep = ":")
cat(label, "\n", sep = "")
holdout A holdout set is kept separate from rows used to fit a model.
logical index `ids < test_start` selects rows before the test boundary.
length `length(train_ids)` counts selected row identifiers.