modularml.core.data_structures.sample_collection

Classes

SampleCollection(samples)

A lightweight container for a list of Sample instances.

class modularml.core.data_structures.sample_collection.SampleCollection(samples: List[Sample])

Bases: object

A lightweight container for a list of Sample instances.

samples

A list of Sample instances.

Type:

List[Sample]

get_all_features(format: str | DataFormat = DataFormat.DICT_NUMPY) Any

Returns all features across all samples in the specified format.

get_all_tags(format: str | DataFormat = DataFormat.DICT_NUMPY) Any

Returns all tags across all samples in the specified format.

Each tag will be returned as a list of values across samples. The format argument controls the output structure.

get_all_targets(format: str | DataFormat = DataFormat.DICT_NUMPY) Any

Returns all targets across all samples in the specified format.

to_backend(backend: str | Backend) SampleCollection

Returns a new SampleCollection with all Data objects converted to the specified backend.