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:

MEAN_NORMALIZED_DIST

Embedding with distance function the mean of those of the normed representations

MEAN_DIST

Embedding with distance the mean of the distance functions

MEAN_ANGLE

Embedding with distance function the mean of the distance functions weighted by cosine distance of the normal vectors

FIRST

First element of the result list

DEFAULT

The default instance to be used.

Inherited from : py: class:Enum

Public Methods:

MEAN_NORMALIZED_DIST

Embedding with distance function the mean of those of the normed representations

MEAN_DIST

Embedding with distance the mean of the distance functions

MEAN_ANGLE

Embedding with distance function the mean of the distance functions weighted by cosine distance of the normal vectors

FIRST

First element of the result list

DEFAULT

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

ConceptEmbedding

__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).