MCPcopy Create free account
hub / github.com/KnowledgeXLab/LeanRAG / local_cluster_embeddings

Function local_cluster_embeddings

_cluster_utils.py:193–199  ·  view source on GitHub ↗
(
    embeddings: np.ndarray, dim: int, num_neighbors: int = 10, metric: str = "cosine"
)

Source from the content-addressed store, hash-verified

191
192
193def local_cluster_embeddings(
194 embeddings: np.ndarray, dim: int, num_neighbors: int = 10, metric: str = "cosine"
195) -> np.ndarray:
196 reduced_embeddings = umap.UMAP(
197 n_neighbors=num_neighbors, n_components=dim, metric=metric
198 ).fit_transform(embeddings)
199 return reduced_embeddings
200
201
202def fit_gaussian_mixture(n_components, embeddings, random_state):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected