Skip to content

list

List feature types.

Classes:

Name Description
ListFeature

Feature representing a collection of sub-features without temporal ordering.

ListFeature #

Feature representing a collection of sub-features without temporal ordering.

A list feature encodes a variable-length sequence of feature instances that share the same feature type, defined by items. In contrast to TimeSeriesFeature, a list does not imply any temporal or sequential relationship between elements; it simply groups multiple instances of the same feature together.

This structure is suitable for representing sets or collections of homogeneous entities, such as a list of detected objects, word embeddings, or samples within a batch.

Parameters:

Name Type Description Default

items #

ItemType

Feature type of each element in the list. All elements must share the same underlying feature definition.

required
Notes
  • The order of elements in the list is not semantically meaningful.
  • This feature type is close to a TimeSeriesFeature without temporal context. It can be used for unordered sequences or collections of arbitrary length.
  • Current limitation: Xpdeep does not yet support variable-length lists. Please pad all lists to a uniform length before using this feature.

Methods:

Name Description
to_model

Convert to a ListFeatureTypeInput instance.

from_model

Instantiate from a json response.

Attributes:

Name Type Description
items ItemType
name Literal['LIST']

items: ItemType #

name: Literal['LIST'] = 'LIST' #

to_model() -> ListFeatureTypeInput #

Convert to a ListFeatureTypeInput instance.

Returns:

Type Description
ListFeatureTypeInput

Model-level representation of the list feature, including its serialized item feature type.

Source code in src/xpdeep/dataset/feature/feature_types/list.py
def to_model(self) -> ListFeatureTypeInput:
    """Convert to a ``ListFeatureTypeInput`` instance.

    Returns
    -------
    ListFeatureTypeInput
        Model-level representation of the list feature, including its serialized
        item feature type.
    """
    return ListFeatureTypeInput(
        name=self.name,
        items=self.items.to_model(),
    )

from_model(feature_type_input: ListFeatureTypeInput) -> ListFeature[ItemType] #

Instantiate from a json response.

Source code in src/xpdeep/dataset/feature/feature_types/list.py
@staticmethod
def from_model(feature_type_input: ListFeatureTypeInput) -> ListFeature[ItemType]:
    """Instantiate from a json response."""
    return ListFeature(items=cast(ItemType, feature_type_from_model(feature_type_input.items)))