Skip to main content

stratified_split

Function stratified_split 

Source
pub fn stratified_split(
    labels: &[i64],
    test_frac: f64,
    seed: u64,
) -> (Vec<usize>, Vec<usize>)
Expand description

Stratified train/test split: maintains class proportions in both sets. labels is an array of integer class labels, test_frac is fraction for test set. Returns (train_indices, test_indices).