Provides functions to split a SampleDataset object by sample, patient, or visit.
Usage
split_by_sample(dataset, ratios, seed = NULL, get_index = FALSE)
Arguments
- dataset
A SampleDataset object.
- ratios
A numeric vector of length 3 indicating train/val/test split ratios. Must sum to 1.
- seed
Optional integer for reproducibility.
- get_index
Logical, whether to return the indices instead of subsets. Default: FALSE.
Value
A list of 3 torch::dataset_subset objects or 3 tensors of indices if get_index = TRUE.