Skip to contents

Creates a random 70/30 split of interval transitions and one-week transitions, with optional downsampling of the training set to a fixed number of transitions (useful for learning-curve experiments). Returns four BirdFlowR::BirdFlowIntervals() objects grouped into training/test lists.

Usage

train_test_split(loader, seed = NULL, training_n_transitions = NULL)

Arguments

loader

A loaded TransitionsLoader() (contains $transitions).

seed

Optional integer for reproducibility (set.seed()).

training_n_transitions

Optional integer. If supplied, subsamples the training intervals to exactly this number (errors if insufficient data).

Value

A list:

training_data

List with train_data, train_data_one_week.

test_data

List with test_data, test_data_one_week.

Details

Side effects: none (beyond RNG if seed is provided).

Examples

if (FALSE) { # \dontrun{
tl <- load_data(TransitionsLoader(trainer))
parts <- train_test_split(tl, seed = 1, training_n_transitions = 1000)
} # }