Skip to main content

train_test_split

Function train_test_split 

Source
pub fn train_test_split<D>(
    dataset: D,
    ratios: &[f64],
    seed: u64,
) -> Vec<SubsetDataset<D>>
where D: Dataset + Clone,
Expand description

Split a dataset into (train, val) or (train, val, test) subsets.

Returns SubsetDataset views over the original dataset.

ยงArguments

  • dataset โ€” the source dataset
  • ratios โ€” slice of 2 or 3 floats that sum to 1.0, e.g. [0.8, 0.2] or [0.7, 0.15, 0.15]
  • seed โ€” random seed for reproducible shuffling of indices