avalanche.benchmarks.utils.DataAttribute

class avalanche.benchmarks.utils.DataAttribute(data: IDataset, name: str | None = None, use_in_getitem=False)[source]

Data attributes manage sample-wise information such as task or class labels.

It provides access to unique values (self.uniques) and their indices (self.val_to_idx). Both fields are initialized lazily.

Data attributes can be efficiently concatenated and subsampled.

__init__(data: IDataset, name: str | None = None, use_in_getitem=False)[source]

Data Attribute.

Parameters:
  • data – a sequence of values, one for each sample.

  • name – a name that uniquely identifies the attribute. It is used by AvalancheDataset to dynamically add it to its attributes.

  • use_in_getitem – If True, AvalancheDataset will add the value at the end of each sample.

Methods

__init__(data[, name, use_in_getitem])

Data Attribute.

concat(other)

Concatenation operation.

subset(indices)

Subset operation.

Attributes

count

Dictionary of value -> count.

data

uniques

Set of unique values in the attribute.

val_to_idx

Dictionary mapping unique values to indices.