peal.data.custom_datasets

Dataset classes for the concrete benchmarks PEAL experiments run on.

Every class here wraps one dataset behind the loaders of peal.data.datasets and materialises it first when necessary: the synthetic generators of peal.data.dataset_generators (square, sparse numbers, funny nodules, stamped-on confounders) are run on demand, and the public benchmarks (MNIST, CelebA, Waterbirds, Camelyon17, RxRx1, NICO++, SkinCon, ISIC, …) are downloaded and rewritten into PEAL’s imgs/ plus data.csv layout. Datasets with a known confounder additionally provide the oracle hooks (sample_to_2d_latent, has_confounder) that the counterfactual explainers and the decision boundary plots call back into.

Functions

datastr

Line-wise variant of parse_datastr().

download_celeba_to

Download the Kaggle CelebA release and lay it out the way PEAL expects.

parse_datastr

Read a CelebA-HQ style annotation file into one whitespace-separated table.

plot_latents_with_arrows

Scatter factual and counterfactual 2D latents and connect them by arrows.

Classes

Camelyon17AugmentedDataset

Camelyon17 exported into PEAL's imgs/ plus data.csv layout.

Camelyon17Dataset

Thin wrapper around the WILDS Camelyon17 tumour dataset.

CelebACopyrighttagDataset

CelebA with a copyright tag stamped into part of the images.

CelebADataset

CelebA with its 40 binary face attributes.

CelebAHQDataset

CelebA-HQ with the CelebAMask-HQ attribute annotations.

ColoredMnist

MNIST with a red tint as a controllable confounder.

ColoredMnistConfig

DataConfig of ColoredMnist with the colouring specification.

FollicleDataset

Ovarian follicle images with expert annotations, taken from Hugging Face.

FunnyNodulesDataset

Synthetic nodules whose internal structure is confounded by roundness.

ISICAnnotatedDataset

ISIC skin lesions with the annotated lesion size as confounder.

MnistDataset

Plain MNIST in the ImageFolder layout, without any confounder.

NicoPlusPlusDataset

NICO++ subset in which the object category is confounded by its context.

OnlySparseNumbersDataset

Synthetic images showing a 2x4 grid of numbers and nothing else.

OnlySparseNumbersZipfDataset

OnlySparseNumbers dataset where target numbers are distributed according to Zipf's law.

RxRx1AugmentedDataset

RxRx1 exported into PEAL's imgs/ plus data.csv layout.

RxRx1Dataset

Thin wrapper around the WILDS RxRx1 cell-imaging dataset.

SkinConDataset

Fitzpatrick17k skin lesions with the skin tone as confounder.

SparseNumbersDataset

Number-grid images with eight additional dense red intensities.

SparseNumbersDenseDataset

Alias/Subclass of SparseNumbersDataset with 8 dense red intensity attributes and sparse numbers.

SparseNumbersDenseZipfDataset

Alias/Subclass of SparseNumbersZipfDataset.

SparseNumbersZipfDataset

SparseNumbers dataset (8 dense red intensity attributes + sparse numbers) where sparse numbers follow Zipf distribution.

SquareDataset

Synthetic 64x64 squares whose colour is confounded by the background.

WaterbirdsDataset

Waterbirds: the bird species is confounded by the background scene.