cleverly.learners.Folds#
- class cleverly.learners.Folds(assignment: ndarray[tuple[Any, ...], dtype[int64]], n_folds: int, origin: FoldOrigin | None = None)[source]#
A cross-fitting partition.
assignment[i]is the index of the fold that holds out observationi. Iterating yields(train_index, test_index)pairs like scikit-learn.- Parameters:
- assignment
ndarray assignment[i]is the index of the fold that holds out observationi.- n_folds
int Number of folds the assignment ranges over.
- origin
FoldOriginorNone, default=None How
random_partition()drew the split.Nonefor a split from any other source: a stratified split or a hand-built one. Equality ignores it, because two splits with the same labels hold out the same rows.
- assignment
Methods#
Attributes#
- Folds.is_single#
Return whether this object contains one fold.
- Folds.n#
Return the number of observations.
- Folds.origin: FoldOrigin | None = None#