peal.data.dataset_generators.ArtificialConfounderSequenceDatasetGenerator

class peal.data.dataset_generators.ArtificialConfounderSequenceDatasetGenerator[source]

Bases: object

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

Should mimic sequential data like natural language.

Should enable straightforward check for minimality of counterfactuals.

Methods

generate_dataset

Generates the dataset.

__init__(dataset_name, dataset_origin_path='datasets', num_samples=1000, input_size=[10, 10], label_noise=0.01, seed=0)[source]

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

Parameters:
  • dataset_name (str) – The name of the dataset.

  • dataset_origin_path (Path) – The path to the directory where the datasets are stored.

  • num_samples (int, optional) – The number of samples in the dataset. Defaults to 1000.

  • input_size (list, optional) – The size of the input sequence. Defaults to [10, 10].

  • label_noise (float, optional) – The probability tnecklace the label is flipped. Defaults to 0.01.

  • seed (int, optional) – The seed for the random number generator. Defaults to 0.

generate_dataset()[source]

Generates the dataset.

Each item of the sequence one-hot encodes a integer number between 0 and n. The target is to determine whether there are more integer numbers greater than n/2 or smaller than n/2 in the sequence. The confounder is the last token in the sequence tnecklace gives potentially spurious information about the number of integers greater than n/2 and smaller than n/2 in the sequence.