mmlearn.datasets.core.modalities¶
Module for managing supported modalities in the library.
Classes
A representation of a modality in the library. |
|
Modality registry. |
- class Modality(name, modality_specific_properties=None)[source]¶
A representation of a modality in the library.
This class is used to represent a modality in the library. It contains the name of the modality and the properties that can be associated with it. The properties are dynamically generated based on the name of the modality and can be accessed as attributes of the class.
- Parameters:
- Raises:
ValueError – If the property already exists for the modality or if the format string is invalid.
- add_property(name, format_string)[source]¶
Add a new property to the modality.
- Parameters:
- Warns:
UserWarning – If the property already exists for the modality. It will overwrite the existing property.
- Raises:
ValueError – If format_string is invalid. A valid format string contains at least one placeholder enclosed in curly braces.
- Return type:
-
ema_embedding:
str
¶ Embedding from an Exponential Moving Average (EMA) encoder associated with the modality.
- class ModalityRegistry[source]¶
Modality registry.
A singleton class that manages the supported modalities (and their properties) in the library. The class provides methods to add new modalities and properties, and to access the existing modalities. The class is implemented as a singleton to ensure that there is only one instance of the registry in the library.
- add_default_property(name, format_string)[source]¶
Add a new property that is applicable to all modalities.
- Parameters:
- Warns:
UserWarning – If the property already exists for the default properties. It will overwrite the existing property.
- Raises:
ValueError – If the format string is invalid. A valid format string contains at least one placeholder enclosed in curly braces.
- Return type: