Skip to content

Val Split

Source

A module for selecting data to be set aside for validation.

create_val_split(stratified_patching, n_val_patches, rng)

Create patching strategies for training and validation.

Note that the provided stratified_patching instance will be modified. The patches from the training patching strategy will never overlap with the patches from the validation patching strategy.

Parameters:

  • stratified_patching (StratifiedPatchingStrategy) –

    The patching strategy to select and exclude validation patches from.

  • n_val_patches (int) –

    The number of validation patches.

  • rng (Generator) –

    Random number generator to ensure reproducibility of the validation patch choice.

Returns:

  • training_patching_strategy ( StratifiedPatchingStrategy ) –

    The patching strategy to be used for training. Patches will be sampled in a stratified way, for each epoch. It excludes all the patches that should be used for validation.

  • validation_patching_strategy ( FixedPatchingStrategy ) –

    The patching strategy to be used for validation. It will return the same patches every epoch.