(
embeddings: np.ndarray,
dim: int,
n_neighbors: int = 15,
metric: str = "cosine",
)
| 177 | return list_data |
| 178 | |
| 179 | def global_cluster_embeddings( |
| 180 | embeddings: np.ndarray, |
| 181 | dim: int, |
| 182 | n_neighbors: int = 15, |
| 183 | metric: str = "cosine", |
| 184 | ) -> np.ndarray: |
| 185 | if n_neighbors is None: |
| 186 | n_neighbors = int((len(embeddings) - 1) ** 0.5) |
| 187 | reduced_embeddings = umap.UMAP( |
| 188 | n_neighbors=n_neighbors, n_components=dim, metric=metric |
| 189 | ).fit_transform(embeddings) |
| 190 | return reduced_embeddings |
| 191 | |
| 192 | |
| 193 | def local_cluster_embeddings( |
no outgoing calls
no test coverage detected