yamle.data.classification module#

class yamle.data.classification.TorchvisionClassificationDataModule(dataset, pad_to_32=False, *args, **kwargs)[source]#

Bases: VisionClassificationDataModule

Data module for the torchvision datasets.

Parameters:
  • dataset (str) – Name of the torchvision dataset. Currently supported are mnist, fashion_mnist, cifar10, cifar100 and tinyimagenet.

  • pad_to_32 (bool) – Whether to pad the images to 32x32. Defaults to False.

outputs_dtype = torch.int64#
prepare_data()[source]#

Download and prepare the data, the data is stored in self._train_dataset, self._validation_dataset and self._test_dataset.

Return type:

None

static add_specific_args(parent_parser)[source]#

This method is used to add datamodel specific arguments to the general parser.

Return type:

ArgumentParser

class yamle.data.classification.TinyImageNetClassificationDataModule(*args, **kwargs)[source]#

Bases: TorchvisionClassificationDataModule

Data module for the TinyImageNet dataset.

inputs_dim = (3, 64, 64)#
outputs_dim = 200#
targets_dim = 1#
mean: Tuple[float, ...] = (0.4802, 0.4481, 0.3975)#
std: Tuple[float, ...] = (0.2302, 0.2265, 0.2262)#
available_transforms: List[str]#
available_test_augmentations: List[str]#
test_augmentations: List[str]#
class yamle.data.classification.TorchvisionClassificationDataModuleMNIST(*args, **kwargs)[source]#

Bases: TorchvisionClassificationDataModule

Data module for the MNIST dataset.

inputs_dim = (1, 28, 28)#
outputs_dim = 10#
targets_dim = 1#
mean: Tuple[float, ...] = (0.1307,)#
std: Tuple[float, ...] = (0.3081,)#
prepare_data()[source]#

Download and prepare the data, the data is stored in self._train_dataset, self._validation_dataset and self._test_dataset.

Return type:

None

available_transforms: List[str]#
available_test_augmentations: List[str]#
test_augmentations: List[str]#
class yamle.data.classification.TorchvisionClassificationDataModuleFashionMNIST(*args, **kwargs)[source]#

Bases: TorchvisionClassificationDataModule

Data module for the FashionMNIST dataset.

inputs_dim = (1, 28, 28)#
outputs_dim = 10#
targets_dim = 1#
mean: Tuple[float, ...] = (0.286,)#
std: Tuple[float, ...] = (0.353,)#
prepare_data()[source]#

Download and prepare the data, the data is stored in self._train_dataset, self._validation_dataset and self._test_dataset.

Return type:

None

available_transforms: List[str]#
available_test_augmentations: List[str]#
test_augmentations: List[str]#
class yamle.data.classification.TorchvisionClassificationDataModuleSVHN(*args, **kwargs)[source]#

Bases: TorchvisionClassificationDataModule

Data module for the SVHN dataset.

inputs_dim = (3, 32, 32)#
outputs_dim = 10#
targets_dim = 1#
mean: Tuple[float, ...] = (0.4377, 0.4438, 0.4728)#
std: Tuple[float, ...] = (0.198, 0.201, 0.197)#
available_transforms: List[str]#
available_test_augmentations: List[str]#
test_augmentations: List[str]#
class yamle.data.classification.TorchvisionClassificationDataModuleCIFAR10(*args, **kwargs)[source]#

Bases: TorchvisionClassificationDataModule

Data module for the CIFAR10 dataset.

inputs_dim = (3, 32, 32)#
outputs_dim = 10#
targets_dim = 1#
mean: Tuple[float, ...] = (0.4914, 0.4822, 0.4465)#
std: Tuple[float, ...] = (0.2023, 0.1994, 0.201)#
available_transforms: List[str]#
available_test_augmentations: List[str]#
test_augmentations: List[str]#
class yamle.data.classification.TorchvisionClassificationDataModuleCIFAR3(indices, *args, **kwargs)[source]#

Bases: TorchvisionClassificationDataModule

Data module for the CIFAR3 dataset.

inputs_dim = (3, 32, 32)#
outputs_dim = 3#
targets_dim = 1#
mean: Tuple[float, ...] = (0.4914, 0.4822, 0.4465)#
std: Tuple[float, ...] = (0.2023, 0.1994, 0.201)#
static add_specific_args(parent_parser)[source]#

Add dataset specific arguments to the parser.

Return type:

ArgumentParser

available_transforms: List[str]#
available_test_augmentations: List[str]#
test_augmentations: List[str]#
class yamle.data.classification.TorchvisionClassificationDataModuleCIFAR5(indices, *args, **kwargs)[source]#

Bases: TorchvisionClassificationDataModule

Data module for the CIFAR5 dataset.

inputs_dim = (3, 32, 32)#
outputs_dim = 5#
targets_dim = 1#
mean: Tuple[float, ...] = (0.4914, 0.4822, 0.4465)#
std: Tuple[float, ...] = (0.2023, 0.1994, 0.201)#
static add_specific_args(parent_parser)[source]#

Add dataset specific arguments to the parser.

Return type:

ArgumentParser

available_transforms: List[str]#
available_test_augmentations: List[str]#
test_augmentations: List[str]#
class yamle.data.classification.TorchvisionClassificationDataModuleCIFAR100(*args, **kwargs)[source]#

Bases: TorchvisionClassificationDataModule

Data module for the CIFAR100 dataset.

inputs_dim = (3, 32, 32)#
outputs_dim = 100#
targets_dim = 1#
mean: Tuple[float, ...] = (0.4914, 0.4822, 0.4465)#
std: Tuple[float, ...] = (0.2023, 0.1994, 0.201)#
available_transforms: List[str]#
available_test_augmentations: List[str]#
test_augmentations: List[str]#
class yamle.data.classification.MedMNISTClassificationDataModule(dataset, pad_to_32=True, *args, **kwargs)[source]#

Bases: VisionClassificationDataModule

Data module for the MedMNIST dataset.

Parameters:
  • dataset (str) – Name of the dataset to use.

  • pad_to_32 (bool) – Whether to pad the images to 32x32. Defaults to True.

outputs_dtype = torch.int64#
prepare_data()[source]#

Download and prepare the data, the data is stored in self._train_dataset, self._validation_dataset and self._test_dataset.

Return type:

None

static add_specific_args(parent_parser)[source]#

Add dataset specific arguments to the parser.

Return type:

ArgumentParser

class yamle.data.classification.PneumoniaMNISTClassificationDataModule(*args, **kwargs)[source]#

Bases: MedMNISTClassificationDataModule

Data module for the PneumoniaMNIST dataset.

inputs_dim = (1, 28, 28)#
outputs_dim = 2#
targets_dim = 1#
mean: Tuple[float, ...] = (0.5404,)#
std: Tuple[float, ...] = (0.2824,)#
available_transforms: List[str]#
available_test_augmentations: List[str]#
test_augmentations: List[str]#
class yamle.data.classification.BreastMNISTClassificationDataModule(*args, **kwargs)[source]#

Bases: MedMNISTClassificationDataModule

Data module for the BreastMNIST dataset.

inputs_dim = (1, 28, 28)#
outputs_dim = 2#
targets_dim = 1#
mean: Tuple[float, ...] = (0.3304,)#
std: Tuple[float, ...] = (0.2057,)#
available_transforms: List[str]#
available_test_augmentations: List[str]#
test_augmentations: List[str]#
class yamle.data.classification.DermaMNISTClassificationDataModule(*args, **kwargs)[source]#

Bases: MedMNISTClassificationDataModule

Data module for the DermaMNIST dataset.

inputs_dim = (3, 28, 28)#
outputs_dim = 7#
targets_dim = 1#
mean: Tuple[float, ...] = (0.7637, 0.5383, 0.5615)#
std: Tuple[float, ...] = (0.1371, 0.154, 0.169)#
available_transforms: List[str]#
available_test_augmentations: List[str]#
test_augmentations: List[str]#
class yamle.data.classification.BloodMNISTClassificationDataModule(*args, **kwargs)[source]#

Bases: MedMNISTClassificationDataModule

Data module for the BloodMNIST dataset.

inputs_dim = (3, 28, 28)#
outputs_dim = 8#
targets_dim = 1#
mean: Tuple[float, ...] = (0.7943, 0.6596, 0.6962)#
std: Tuple[float, ...] = (0.2156, 0.2415, 0.1179)#
available_transforms: List[str]#
available_test_augmentations: List[str]#
test_augmentations: List[str]#
class yamle.data.classification.ToyTwoMoonsClassificationDataModule(noise, num_samples, *args, **kwargs)[source]#

Bases: BaseDataModule

Data module for a toy classification problem between data coming from 2 classes with 2 features.

Parameters:
  • noise (float) – Noise to add to the data.

  • num_samples (int) – Number of samples to generate.

inputs_dim = (2,)#
outputs_dim = 2#
targets_dim = 1#
task = 'classification'#
inputs_dtype = torch.float32#
outputs_dtype = torch.int64#
prepare_data()[source]#

Generate the toy classification dataset.

Return type:

None

plot(tester, save_path, specific_name='')[source]#

Plot the data and the decision boundary of the model.

Return type:

None

static add_specific_args(parent_parser)[source]#

Add dataset specific arguments to the parser.

Return type:

ArgumentParser

class yamle.data.classification.ToyTwoCirclesClassificationDataModule(*args, **kwargs)[source]#

Bases: ToyTwoMoonsClassificationDataModule

Toy two ovals classification dataset.

prepare_data()[source]#

Generate the toy classification dataset.

Return type:

None

available_transforms: List[str]#
available_test_augmentations: List[str]#
test_augmentations: List[str]#
class yamle.data.classification.UCIClassificationDataModule(dataset, *args, **kwargs)[source]#

Bases: RealWorldClassificationDataModule

Data module for the UCI classification datasets.

Currently supports the following datasets:
  • Breast Cancer

  • Adult income

  • Car evaluation

  • Credit default

  • Dermatology

Parameters:

dataset (str) – Name of the dataset to use.

plot(tester, save_path, specific_name='')[source]#

Plots the dataset.

Return type:

None

class yamle.data.classification.BreastCancerUCIClassificationDataModule(*args, **kwargs)[source]#

Bases: UCIClassificationDataModule

Data module for the Breast Cancer dataset.

outputs_dim = 2#
outputs_dtype = torch.int64#
inputs_dim = (9,)#
inputs_dtype = torch.float32#
task = 'classification'#
class yamle.data.classification.AdultIncomeUCIClassificationDataModule(*args, **kwargs)[source]#

Bases: UCIClassificationDataModule

Data module for the Adult Income dataset.

outputs_dim = 2#
outputs_dtype = torch.int64#
inputs_dim = (108,)#
inputs_dtype = torch.float32#
task = 'classification'#
class yamle.data.classification.CarEvaluationUCIClassificationDataModule(*args, **kwargs)[source]#

Bases: UCIClassificationDataModule

Data module for the Car Evaluation dataset.

outputs_dim = 4#
outputs_dtype = torch.int64#
inputs_dim = (21,)#
inputs_dtype = torch.float32#
task = 'classification'#
class yamle.data.classification.CreditUCIClassificationDataModule(*args, **kwargs)[source]#

Bases: UCIClassificationDataModule

Data module for the Credit Default dataset.

outputs_dim = 2#
outputs_dtype = torch.int64#
inputs_dim = (23,)#
inputs_dtype = torch.float32#
task = 'classification'#
class yamle.data.classification.DermatologyUCIClassificationDataModule(*args, **kwargs)[source]#

Bases: UCIClassificationDataModule

Data module for the Dermatology dataset.

outputs_dim = 6#
outputs_dtype = torch.int64#
inputs_dim = (34,)#
inputs_dtype = torch.float32#
task = 'classification'#
class yamle.data.classification.ECG5000ClassificationDataModule(*args, **kwargs)[source]#

Bases: ECG5000DataModule

Data module for the ECG5000 dataset.

outputs_dim = 5#
outputs_dtype = torch.int64#
inputs_dtype = torch.float32#
targets_dim = 1#
task = 'classification'#
prepare_data()[source]#

Download and prepare the data

Return type:

None

plot(tester, save_path, specific_name='')[source]#

Plots the dataset.

Return type:

None