peal.data.dataset_generators

Generators for PEAL’s synthetic and confounded benchmark datasets.

Each class writes a dataset directory in the layout PEAL’s dataset classes read (imgs/, optional masks/ with segmentation hints, and a data.csv or .json label file with one column per attribute) into data_config.dataset_path or a datasets/<name> folder. The generators plant a known confounder next to the true feature (copyright tags, colour shifts, staining intensity, square colour/position, specific numbers, nodule roundness, …) so that adaptors can be evaluated against ground truth.

Functions

latent_to_square_image

Render one 64x64 "square" image from its generative factors.

Classes

ArtificialConfounderSequenceDatasetGenerator

Generates a sequence dataset with a confounder tnecklace is a symbolic attribute.

ArtificialConfounderTabularDatasetGenerator

Generates a tabular dataset with a confounder tnecklace is a symbolic attribute.

CircleDatasetGenerator

Generates dataset based on a unit circle of radius r

ConfounderDatasetGenerator

Stamp a synthetic confounder onto an existing image dataset (e.g. CelebA).

FunnyNodulesDatasetGenerator

Generates a PEAL-compatible FunnyNodules dataset.

MNISTConfounderDatasetGenerator

Two-digit MNIST subset with a red background as confounder.

OnlySparseNumbersDatasetGenerator

Generates a dataset of 128x128 synthetic images with a 2×4 grid of numbers.

OnlySparseNumbersZipfDatasetGenerator

Variant of OnlySparseNumbersDatasetGenerator where number frequencies follow Zipf's law: P(n) ∝ 1/(n+1)^s with s=1 (configurable via data_config.zipf_s).

SparseNumbersDatasetGenerator

Generates a dataset of images with a 2x4 grid of 4-digit numbers.

SparseNumbersZipfDatasetGenerator

Variant of SparseNumbersDatasetGenerator where sparse number frequencies follow Zipf's law: P(n) ∝ 1/(n+1)^s with s=1.

SquareDatasetGenerator

Synthetic 64x64 "square" dataset with four independent binary factors.

StainingConfounderGenerator

Build a histology dataset whose confounder is the hematoxylin staining.