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

Function fit_gaussian_mixture

_cluster_utils.py:202–210  ·  view source on GitHub ↗
(n_components, embeddings, random_state)

Source from the content-addressed store, hash-verified

200
201
202def fit_gaussian_mixture(n_components, embeddings, random_state):
203 gm = GaussianMixture(
204 n_components=n_components,
205 random_state=random_state,
206 n_init=5,
207 init_params='k-means++'
208 )
209 gm.fit(embeddings)
210 return gm.bic(embeddings)
211
212
213def get_optimal_clusters(embeddings, max_clusters=50, random_state=0, rel_tol=1e-3):

Callers 1

get_optimal_clustersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected