VALIDATION#

Classes#

class datasets.utils.validation.ValidationDataset(data, targets, transform=None, target_transform=None)[source]#

Bases: Dataset

Functions#

datasets.utils.validation.get_train_val(train, test_transform, dataset, val_perc=0.1)[source]#

Extract val_perc% of the training set as the validation set.

Parameters:
  • train (Dataset) – training dataset

  • test_transform (Module) – transformation of the test dataset

  • dataset (str) – dataset name

  • val_perc (float) – percentage of the training set to be extracted

Returns:

the training set and the validation set

datasets.utils.validation.get_validation_indexes(validation_size, dataset, seed=None)[source]#

Returns the indexes of train and validation datasets from the given dataset, according to the validation size.

Parameters:
  • validation_size (float) – percentage of samples for each class to be used for validation (between 0 and 100)

  • dataset (Dataset) – the dataset to split

  • seed (int) – the seed for the random generator. If None, the seed is set to 0

Returns:

the train and validation dataset indexes

Return type:

tuple