The 'assign_labels' parameter should be 'kmeans' or 'discretize', but '%s' was given
Package:
scikit-learn
47032

Exception Class:
ValueError
Raise code
""" graph should contain only one connect component, elsewhere
the results make little sense.
This algorithm solves the normalized cut for k=2: it is a
normalized spectral clustering.
"""
if assign_labels not in ('kmeans', 'discretize'):
raise ValueError("The 'assign_labels' parameter should be "
"'kmeans' or 'discretize', but '%s' was given"
% assign_labels)
random_state = check_random_state(random_state)
n_components = n_clusters if n_components is None else n_components
# The first eigenvector is constant only for fully connected graphs
# an
Links to the raise (1)
https://github.com/scikit-learn/scikit-learn/blob/c67518350f91072f9d37ed09c5ef7edf555b6cf6/sklearn/cluster/_spectral.py#L259Ways to fix
if assign_labels not in ('kmeans', 'discretize', 'cluster_qr'):
raise ValueError("The 'assign_labels' parameter should be " "'kmeans' or 'discretize' or 'cluster_qr', but '%s' was given" % assign_labels)
#see https://scikit-learn.org/stable/modules/generated/sklearn.cluster.SpectralClustering.html#sklearn-cluster-spectralclustering
#assign_labels{‘kmeans’, ‘discretize’, ‘cluster_qr’}, default=’kmeans’
#Changed in version 1.1: Added new labeling method ‘cluster_qr’.
Add a possible fix
Please authorize to post fix