Skip to content

Add joint/centroid embedding query to EmbeddingReaderInterface #31

Description

@gkennos

Motivation

No method exists to fetch N concept embeddings and return their weighted mean as a query vector.

Pitch

Use case: "find concepts similar to the combination of GLP-1 receptor agonist + type 2 diabetes" --> compute centroid of the two stored embeddings, then pass to get_nearest_concepts

Alternatives

No response

Additional context

Proposed signature on EmbeddingReaderInterface:

def get_joint_embedding(
    self,
    concept_ids: tuple[int, ...],
    weights: tuple[float, ...] | None = None,
) -> np.ndarray

Implementation should use get_embeddings_by_concept_ids and normalise the weighted sum for cosine space

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions