dataeval.data.Conformer

class dataeval.data.Conformer

Base class for a per-datum conformation applied by Conform.

A conformer rewrites the content of a dataset to make it conform to a target schema — relabeling to a reference vocabulary now; renaming metadata factors, converting metadata values, or mutating image/video later. Subclasses override:

  • conform_metadata() — transform dataset-level metadata (e.g. replace index2label); called once at construction.

  • keeps() — a cheap predicate deciding whether a datum survives; scanned once at construction to fix the conformed dataset’s length.

  • conform_datum() — transform a single datum; applied lazily on access.

Subclasses that read the target of each datum should set requires to declare the MAITE datum shape they need; Conform aggregates these and validates the source dataset once, upfront, raising MaiteShapeError before any datum is conformed.

conform_datum(datum)

Return the transformed datum (default: unchanged).

conform_metadata(metadata)

Return possibly-updated dataset-level metadata (default: unchanged).

keeps(datum)

Return whether datum survives this conformer (default: always).