mmlearn.datasets.core.data_collator¶
Data collators for batching examples.
Functions
Classes
Default data collator for batching examples. |
- class DefaultDataCollator(batch_processors=None)[source]¶
Default data collator for batching examples.
This data collator will collate a list of
Example
objects into a batch. It can also apply processing functions to specified keys in the batch before returning it.- Parameters:
batch_processors (Optional[dict[str, Callable[[Any], Any]]], optional, default=None) – Dictionary of callables to apply to the batch before returning it.
- Raises:
ValueError – If the batch processor for a key does not return a dictionary with the key in it.
-
batch_processors:
Optional
[dict
[str
,Callable
[[Any
],Any
]]] = None¶ Dictionary of callables to apply to the batch before returning it. The key is the name of the key in the batch, and the value is the processing function to apply to the key. The processing function must take a single argument and return a single value. If the processing function returns a dictionary, it must contain the key that was processed in it (all the other keys will also be included in the batch).