gemseo / mlearning / resampling

Show inherited members

cross_validation module

A cross-validation tool for resampling and surrogate modeling.

class gemseo.mlearning.resampling.cross_validation.CrossValidation(sample_indices, n_folds=5, randomize=False, seed=0)[source]

Bases: Resampler

A cross-validation tool for resampling and surrogate modeling.

Parameters:
  • sample_indices (NDArray[int]) – The original indices of the samples.

  • n_folds (int) –

    The number of folds.

    By default it is set to 5.

  • randomize (bool) –

    Whether the sample indices are shuffled before splitting.

    By default it is set to False.

  • seed (int | None) –

    The seed to initialize the random generator. If None, then fresh, unpredictable entropy will be pulled from the OS.

    By default it is set to 0.

property n_folds: int

The number of folds.

name: str

The name of the resampler.

Use the class name by default.

property randomize: bool

Whether the sample indices are shuffled before splitting.

property shuffled_sample_indices: NDArray[int]

The original indices of the samples.