(iterable, ngroups=-1, fractions=None, shuffle=True)
| 500 | |
| 501 | |
| 502 | def _split_into_groups(iterable, ngroups=-1, fractions=None, shuffle=True): |
| 503 | if shuffle: |
| 504 | iterable = np.copy(iterable) |
| 505 | np.shuffle(iterable) |
| 506 | |
| 507 | start_idxs, end_idxs = _group_start_end_idxs(len(iterable), ngroups, |
| 508 | fractions) |
| 509 | |
| 510 | return [iterable[start:end] for start, end in zip(start_idxs, end_idxs)] |
| 511 | |
| 512 | |
| 513 | def cv_partition_idxs(labels, n_folds=5, fractions=None, stratified=True): |
no test coverage detected