Last active
April 15, 2021 07:38
-
-
Save a-agmon/55d17f14dc2b5f2beb68e3e422d2cb09 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.mixture import GaussianMixture as GMM | |
def cluster_gmm(matrix, k=4): | |
gmm_model = GMM(k, covariance_type='full', random_state=0, n_init=10) | |
gmm_model.fit(matrix) | |
gmm_labels = gmm_model.predict(matrix) | |
centers = gmm_model.means_ | |
return gmm_model, gmm_labels, centers | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment