Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sklearn/cluster/_spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from scipy.sparse import csc_matrix

from ..base import BaseEstimator, ClusterMixin
from ..utils._param_validation import Interval, StrOptions
from ..utils._param_validation import Interval, StrOptions, validate_params
from ..utils import check_random_state, as_float_array
from ..metrics.pairwise import pairwise_kernels, KERNEL_PARAMS
from ..neighbors import kneighbors_graph, NearestNeighbors
Expand Down Expand Up @@ -190,6 +190,7 @@ def discretize(
return labels


@validate_params({"affinity": ["array-like", "sparse matrix"]})
def spectral_clustering(
affinity,
*,
Expand Down
1 change: 1 addition & 0 deletions sklearn/tests/test_public_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def test_function_param_validation(func_module):

PARAM_VALIDATION_CLASS_WRAPPER_LIST = [
("sklearn.cluster.affinity_propagation", "sklearn.cluster.AffinityPropagation"),
("sklearn.cluster.spectral_clustering", "sklearn.cluster.SpectralClustering"),
("sklearn.covariance.ledoit_wolf", "sklearn.covariance.LedoitWolf"),
("sklearn.covariance.oas", "sklearn.covariance.OAS"),
("sklearn.decomposition.dict_learning", "sklearn.decomposition.DictionaryLearning"),
Expand Down