yamle.data.regression module#
- class yamle.data.regression.ToyRegressionDataModule(num_samples, test_samples, *args, **kwargs)[source]#
Bases:
BaseDataModuleData module for a toy regression 1D dataset.
Implements a toy regression dataset with 1D inputs and 1D outputs.
$ y = sin(3x) + x^2 - 0.3 + mathcal{N}(0, 0.2) + mathcal{n}(0, gaussian_noise_sigma) $ on the interval $ [-1, 1] $. but with a gap in the middle from $ [-0.2, 0.2] $.
The validation and test data is on intervals $ [-2, 2] $ and witout $mathcal{N}(0, 1)$.
- Parameters:
- outputs_dim = 2#
- targets_dim = 1#
- outputs_dtype = torch.float32#
- inputs_dim = (1,)#
- task = 'regression'#
- plot(tester, save_path, specific_name='')[source]#
Plot the data and the uncertainty of the model.
- Return type:
None
- 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.regression.UCIRegressionDataModule(dataset, *args, **kwargs)[source]#
Bases:
RealWorldRegressionDataModuleData module for the UCI regression datasets.
- Currently supports the following datasets:
Concrete
Energy
Boston
Wine
Yacht
Abalone
Telemonitoring
- Parameters:
dataset¶ (str) – Name of the dataset to use.
- task = 'regression'#
- outputs_dim = 2#
- outputs_dtype = torch.float32#
- inputs_dtype = torch.float32#
- available_transforms: List[str]#
- available_test_augmentations: List[str]#
- test_augmentations: List[str]#
- class yamle.data.regression.MedMNISTRegressionDataModule(dataset, pad_to_32=True, *args, **kwargs)[source]#
Bases:
VisionRegressionDataModuleData module for the MedMNIST dataset.
- Parameters:
- outputs_dtype = torch.float32#
- 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
- available_transforms: List[str]#
- available_test_augmentations: List[str]#
- test_augmentations: List[str]#
- class yamle.data.regression.RetinaMNISTDataModule(*args, **kwargs)[source]#
Bases:
MedMNISTRegressionDataModuleData module for the RetinaMNIST dataset.
- inputs_dim = (3, 28, 28)#
- outputs_dim = 2#
- targets_dim = 1#
-
mean:
Tuple[float,...] = (0.3974, 0.2446, 0.1554)#
-
std:
Tuple[float,...] = (0.2977, 0.2001, 0.1503)#
- available_transforms: List[str]#
- available_test_augmentations: List[str]#
- test_augmentations: List[str]#
- class yamle.data.regression.ConcreteUCIRegressionDataModule(*args, **kwargs)[source]#
Bases:
UCIRegressionDataModuleData module for the Concrete UCI regression dataset.
- inputs_dim = (8,)#
- available_transforms: List[str]#
- available_test_augmentations: List[str]#
- test_augmentations: List[str]#
- class yamle.data.regression.EnergyUCIRegressionDataModule(*args, **kwargs)[source]#
Bases:
UCIRegressionDataModuleData module for the Energy UCI regression dataset.
- inputs_dim = (9,)#
- available_transforms: List[str]#
- available_test_augmentations: List[str]#
- test_augmentations: List[str]#
- class yamle.data.regression.BostonUCIRegressionDataModule(*args, **kwargs)[source]#
Bases:
UCIRegressionDataModuleData module for the Boston UCI regression dataset.
- inputs_dim = (13,)#
- available_transforms: List[str]#
- available_test_augmentations: List[str]#
- test_augmentations: List[str]#
- class yamle.data.regression.WineQualityUCIRegressionDataModule(*args, **kwargs)[source]#
Bases:
UCIRegressionDataModuleData module for the Wine Quality UCI regression dataset.
- inputs_dim = (11,)#
- available_transforms: List[str]#
- available_test_augmentations: List[str]#
- test_augmentations: List[str]#
- class yamle.data.regression.YachtUCIRegressionDataModule(*args, **kwargs)[source]#
Bases:
UCIRegressionDataModuleData module for the Yacht Hydrodynamics UCI regression dataset.
- inputs_dim = (6,)#
- available_transforms: List[str]#
- available_test_augmentations: List[str]#
- test_augmentations: List[str]#
- class yamle.data.regression.AbaloneUCIRegressionDataModule(*args, **kwargs)[source]#
Bases:
UCIRegressionDataModuleData module for the Abalone UCI regression dataset.
- inputs_dim = (10,)#
- available_transforms: List[str]#
- available_test_augmentations: List[str]#
- test_augmentations: List[str]#
- class yamle.data.regression.TelemonitoringUCIRegressionDataModule(*args, **kwargs)[source]#
Bases:
UCIRegressionDataModuleData module for the Telemonitoring UCI regression dataset.
We use the subject# column to split the data manually between train, validation, calibration and test sets to ensure that a patient does not appear in more than one set.
We predict the total_UPDRS column.
- inputs_dim = (20,)#
- prepare_data()[source]#
Prepares the data for training, validation, calibration and testing.
- Return type:
None
- available_transforms: List[str]#
- available_test_augmentations: List[str]#
- test_augmentations: List[str]#
- class yamle.data.regression.TimeSeriesRegressionDataModule(time_window, *args, **kwargs)[source]#
Bases:
RealWorldRegressionDataModuleThis is a wrapper class for time series regression datasets.
- Parameters:
time_window¶ (int) – The number of time steps to use for creating the time series.
- plot(tester, save_path, specific_name='')[source]#
Plots the predictions of the model on the test set.
- 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.regression.TemperatureTimeSeriesDataModule(time_window, *args, **kwargs)[source]#
Bases:
TimeSeriesRegressionDataModuleData module for temperature time series regression.
- outputs_dim = 2#
- inputs_dim = (1,)#
- task = 'regression'#
- available_transforms: List[str]#
- available_test_augmentations: List[str]#
- test_augmentations: List[str]#
- class yamle.data.regression.WikiFaceDataset(root_dir, seed=42, image_size=(64, 64), test_portion=0.1, transform=None, split='train')[source]#
Bases:
DatasetDataset for the WikiFace age prediction task.
The dataset is the wikipedia portion of the dataset: https://data.vision.ee.ethz.ch/cvl/rrothe/imdb-wiki/
- Parameters:
root_dir¶ (str) – The root directory to store the dataset.
seed¶ (int) – The seed for the random number generator.
image_size¶ (Tuple[int, int]) – The size of the image.
test_portion¶ (float) – The portion of the dataset to use for testing.
transform¶ (Optional[Callable]) – The transform to apply to the image.
split¶ (str) – The split of the dataset to use. Either ‘train’ or ‘test’.
- md5sum = 'f536eb7f5eae229ae8f286184364b42b'#
- class yamle.data.regression.TorchvisionRegressionDataModule(dataset, *args, **kwargs)[source]#
Bases:
VisionRegressionDataModule- outputs_dtype = torch.float32#
- prepare_data()[source]#
Download and prepare the data, the data is stored in self._train_dataset and self._test_dataset.
- Return type:
None
- available_transforms: List[str]#
- available_test_augmentations: List[str]#
- test_augmentations: List[str]#
- class yamle.data.regression.WikiFaceRegressionDataModule(*args, **kwargs)[source]#
Bases:
TorchvisionRegressionDataModuleData module for the WikiFace dataset.
- inputs_dim = (3, 64, 64)#
- outputs_dim = 2#
- targets_dim = 1#
- outputs_dtype = torch.float32#
-
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.regression.TorchvisionRotationRegressionDataModule(dataset, pad_to_32=False, min_angle=0, max_angle=90, *args, **kwargs)[source]#
Bases:
VisionRegressionDataModuleData module for the rotation regression task.
It can load the most common torchvision datasets and apply a rotation to the images to create a rotation regression task. The task is to predict the rotation of the image.
- Parameters:
dataset¶ (str) – The dataset to load. Either ‘mnist’, ‘fashionmnist’, ‘cifar10’, ‘cifar100’, ‘svhn’, ‘tinyimagenet’.
pad_to_32¶ (bool) – Whether to pad the images to 32x32.
min_angle¶ (float) – The minimum angle to rotate the image. Defaults to 0.
max_angle¶ (float) – The maximum angle to rotate the image. Defaults to 90.
- outputs_dim = 2#
- targets_dim = 1#
- outputs_dtype = torch.float32#
- 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
- available_transforms: List[str]#
- available_test_augmentations: List[str]#
- test_augmentations: List[str]#
- class yamle.data.regression.TinyImageNetRotationRegressionDataModule(*args, **kwargs)[source]#
Bases:
TorchvisionRotationRegressionDataModuleData module for the rotation regression task on TinyImageNet.
- inputs_dim = (3, 64, 64)#
-
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.regression.TorchvisionRotationRegressionDataModuleMNIST(*args, **kwargs)[source]#
Bases:
TorchvisionRotationRegressionDataModuleData module for the rotation regression task on MNIST.
- inputs_dim = (1, 28, 28)#
-
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.regression.TorchvisionRotationRegressionDataModuleFashionMNIST(*args, **kwargs)[source]#
Bases:
TorchvisionRotationRegressionDataModuleData module for the rotation regression task on FashionMNIST.
- inputs_dim = (1, 28, 28)#
-
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.regression.TorchvisionRotationRegressionDataModuleSVHN(*args, **kwargs)[source]#
Bases:
TorchvisionRotationRegressionDataModuleData module for the rotation regression task on SVHN.
- inputs_dim = (3, 32, 32)#
-
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.regression.TorchvisionRotationRegressionDataModuleCIFAR10(*args, **kwargs)[source]#
Bases:
TorchvisionRotationRegressionDataModuleData module for the rotation regression task on CIFAR10.
- inputs_dim = (3, 32, 32)#
-
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.regression.TorchvisionRotationRegressionDataModuleCIFAR100(*args, **kwargs)[source]#
Bases:
TorchvisionRotationRegressionDataModuleData module for the rotation regression task on CIFAR100.
- inputs_dim = (3, 32, 32)#
-
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]#