Algorithm · Lyft · Hard
Implement a stratified k-fold cross-validation splitter. You are given: a label array y of length n, where labels may be integers or strings, an integer k: the number of folds, with 2 <= k <= n. Return k folds. Each fold is a pair of index lists: train_idx: indices that belong to the training partition, val_idx: indices that belong to the validation partition. Requirements: Stratification: For every class c, the share of class c inside any val_idx should match its share in…
Checking your access…