mlrl.testbed.experiments.fold module

Author: Michael Rapp (michael.rapp.ml@gmail.com)

Provides classes for representing folds of a dataset.

class mlrl.testbed.experiments.fold.Fold(index: int)

Bases: object

Represents an individual fold of a dataset, i.e., a specific subset of the examples that are contained in the dataset.

Attributes:

index: The index of the fold

index: int
class mlrl.testbed.experiments.fold.FoldingStrategy(num_folds: int, first: int, last: int)

Bases: object

Represents a strategy for folding a dataset, i.e., for creating different subsets of the examples that are contained in the dataset.

Attributes:

num_folds: The total number of folds first: The index of the first fold to be created (inclusive) last: The index of the last fold to be created (exclusive)

first: int
property folds: Generator[Fold, None, None]

Returns a generator that generates all folds that are created by the strategy.

Returns:

The generator

property is_cross_validation_used: bool

True, if a cross validation is used, False otherwise.

is_last_fold(fold: Fold) bool

Returns whether a given fold is the last fold.

Parameters:

fold – The fold to be checked

Returns:

True, if the given fold is the last fold, False otherwise

property is_subset

True, if only a subset of the folds is actually created, False otherwise.

last: int
num_folds: int
property num_folds_in_subset: int

The number of folds that are actually created.