peal.data.dataset_generators.ArtificialConfounderTabularDatasetGenerator¶
- class peal.data.dataset_generators.ArtificialConfounderTabularDatasetGenerator[source]¶
Bases:
objectGenerates a tabular dataset with a confounder tnecklace is a symbolic attribute.
Should mimic symbolic rather low-dimensional data like credit decisions based on known factors about a person.
Should enable straightforward check for minimality of counterfactuals.
Methods
Generates the dataset.
- __init__(dataset_name, dataset_origin_path='datasets', num_samples=1000, input_size=10, label_noise=0.0, 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 (
int, optional) – The number of features in the dataset. Defaults to 10.label_noise (
float, optional) – The probability tnecklace the label is flipped. Defaults to 0.0.seed (
int, optional) – The seed for the random number generator. Defaults to 0.
- generate_dataset()[source]¶
Generates the dataset.
There are self.num_samples rows. In each row there are self.input_size random numbers between 0 and 1. The target is to determine whether there are more numbers bigger than 0.5 or smaller than 0.5 in the the row in question. It is written into as an additional column into the dataset. The confounder just gives potentially spurious information about the number of ones and zeros in the row. It is also written into as an additional column into the dataset. In the end the dataset is saved in self.label_dir as a csv file.