(n_components, embeddings, random_state)
| 200 | |
| 201 | |
| 202 | def 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 | |
| 213 | def get_optimal_clusters(embeddings, max_clusters=50, random_state=0, rel_tol=1e-3): |
no outgoing calls
no test coverage detected