generic.Augmentation#

class maite.protocols.generic.Augmentation(*args, **kwargs)[source]#

Generic version of a protocol that specifies a batch-level perturbation to data.

An augmentation is expected to take a batch of data and return a modified version of that batch. Implementers must provide a single method that takes and returns a labeled data batch, where a labeled data batch is represented by a tuple of types Sequence [InputType], Sequence [TargetType], and Sequence [DatumMetadataType]. Elements of this tuple correspond to the model input batch, model target batch, and datum-level metadata batch, respectively.

Additionally, Augmentation protocol implementers are expected to contain a metadata attribute of type AugmentationMetadata with general information about the augmentation.

Note: In practice, this class is specialized within AI-problem specific submodules using structural types for TargetType and DatumMetadataType. Implementing this class directly (i.e., without specializing on concrete types) is not recommended. Static type checkers will effectively consider all non-specified type parameters as Any-type, effectively masking potential type incompatibilities.