peal.data.custom_datasets.SparseNumbersDataset¶
- class peal.data.custom_datasets.SparseNumbersDataset[source]¶
Bases:
Image2MixedDatasetNumber-grid images with eight additional dense red intensities.
SparseNumbersDatasetGeneratorwrites the dataset on first use. Each csv row holds 8Redintensities followed by 8 number slots (the number drawn there, or-1).__getitem__expands the slots into a binary vector of lengthconfig.output_split(default 1000) and concatenates the red intensities, soattributesisNum0 ... Num<n-1>followed byRed1 ... Red8; the red channels act as confounders of the sparse number labels.- Parameters:
config (
DataConfig) – Usesdataset_path,output_split,class_ratiosandconfounding_factors.**kwargs – Forwarded to the generator and to
Image2MixedDataset.
- Variables:
attributes (
listofstr) – The expanded label vector;attributes_positiveandattributes_negativehold its phrasings.
Methods
Restrict
keysto the samples of one class of the selected attribute.Subsample
keysto the proportions inconfig.class_ratios.Attributes
- __init__(config, **kwargs)[source]¶
Generate the dataset if missing and build the expanded attribute names.
- Parameters:
config (DataConfig)