EmbeddingReduction
- class hybrid_learning.concepts.analysis.analysis_handle.EmbeddingReduction(value)[source]
Bases:
Enum
Aggregator callables to get the mean from a list of embeddings.
Public Data Attributes:
Embedding with distance function the mean of those of the normed representations
Embedding with distance the mean of the distance functions
Embedding with distance function the mean of the distance functions weighted by cosine distance of the normal vectors
First element of the result list
The default instance to be used.
Inherited from : py: class:Enum
Public Methods:
Embedding with distance function the mean of those of the normed representations
Embedding with distance the mean of the distance functions
Embedding with distance function the mean of the distance functions weighted by cosine distance of the normal vectors
First element of the result list
The default instance to be used.
Special Methods:
__init__
(func)The init routine for enum members makes function available as instance fields.
__call__
(embeddings)Call aggregation function behind the instance on the embeddings.
__new__
(value)Inherited from : py: class:Enum
__repr__
()Return repr(self).
__str__
()Return str(self).
__dir__
()Returns all members and all public methods
__format__
(format_spec)Returns format using actual value type unless __str__ has been overridden.
__hash__
()Return hash(self).
__reduce_ex__
(proto)Helper for pickle.
- __call__(embeddings)[source]
Call aggregation function behind the instance on the embeddings.
- Parameters
embeddings (Sequence[ConceptEmbedding]) –
- Return type
- __init__(func)[source]
The init routine for enum members makes function available as instance fields. It is automatically called for all defined enum instances.
- Parameters
func (Callable[[Sequence[ConceptEmbedding]], ConceptEmbedding]) –
- DEFAULT = (<bound method ConceptEmbedding.mean of <class 'hybrid_learning.concepts.models.embeddings.ConceptEmbedding'>>,)
The default instance to be used.
- FIRST = (<bound method ConceptEmbedding.first of <class 'hybrid_learning.concepts.models.embeddings.ConceptEmbedding'>>,)
First element of the result list
- MEAN_ANGLE = (<bound method ConceptEmbedding.mean_by_angle of <class 'hybrid_learning.concepts.models.embeddings.ConceptEmbedding'>>,)
Embedding with distance function the mean of the distance functions weighted by cosine distance of the normal vectors
- MEAN_DIST = (<bound method ConceptEmbedding.mean_by_distance of <class 'hybrid_learning.concepts.models.embeddings.ConceptEmbedding'>>,)
Embedding with distance the mean of the distance functions
- MEAN_NORMALIZED_DIST = (<bound method ConceptEmbedding.mean of <class 'hybrid_learning.concepts.models.embeddings.ConceptEmbedding'>>,)
Embedding with distance function the mean of those of the normed representations
- function: Callable[[Sequence[ConceptEmbedding]], ConceptEmbedding]
Actual function that reduces a list of embeddings to a new one.
Note
The function is manually saved as attribute during
__init__
due to the following issue: Enums currently do not support functions as values, as explained in this and this discussion. The chosen workaround follows this suggestion (though the code is not used).