How to use the spectral.SpectralClustering function in spectral

To help you get started, we’ve selected a few spectral examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GenTang / intro_ds / ch10-unsupervised / clustering / spectral_clustering / gmm_vs_spectral.py View on Github external
def train_spectral_clustering(data, cluster_num):
    """
    训练谱聚类模型
    """
    model = SpectralClustering(n_clusters=cluster_num, affinity="rbf",
                               gamma=100, assign_labels="kmeans")
    model.fit(data)
    return model