generic.Dataset#
- class maite.protocols.generic.Dataset(*args, **kwargs)[source]#
Generic version of a protocol that specifies datum-level random access to a data source.
Implementers must provide index lookup (via
__getitem__(ind: int, /)method) and supportlen(via__len__()method). Data elements returned via__getitem__correspond to tuples ofInputType,TargetType, andDatumMetadataType. The shape/value semantics of these three types are dictated by the concrete types used to specialize this generic.Additionally, Datasets are expected to contain a metadata attribute of type
DatasetMetadatawith general information about the data source.Note: In practice, this class is specialized within AI-problem specific submodules using structural types for
InputType,TargetType, andDatumMetadataType. 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 asAny-type, effectively masking potential type incompatibilities.