Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 81f3b63

Browse filesBrowse files
Ahmedbghglemaitre
andauthored
MAINT Parameters validation for spectral_clustering (scikit-learn#25378)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
1 parent 4be28d4 commit 81f3b63
Copy full SHA for 81f3b63

File tree

Expand file treeCollapse file tree

2 files changed

+3
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-1
lines changed

‎sklearn/cluster/_spectral.py

Copy file name to clipboardExpand all lines: sklearn/cluster/_spectral.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from scipy.sparse import csc_matrix
1616

1717
from ..base import BaseEstimator, ClusterMixin
18-
from ..utils._param_validation import Interval, StrOptions
18+
from ..utils._param_validation import Interval, StrOptions, validate_params
1919
from ..utils import check_random_state, as_float_array
2020
from ..metrics.pairwise import pairwise_kernels, KERNEL_PARAMS
2121
from ..neighbors import kneighbors_graph, NearestNeighbors
@@ -190,6 +190,7 @@ def discretize(
190190
return labels
191191

192192

193+
@validate_params({"affinity": ["array-like", "sparse matrix"]})
193194
def spectral_clustering(
194195
affinity,
195196
*,

‎sklearn/tests/test_public_functions.py

Copy file name to clipboardExpand all lines: sklearn/tests/test_public_functions.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def test_function_param_validation(func_module):
152152

153153
PARAM_VALIDATION_CLASS_WRAPPER_LIST = [
154154
("sklearn.cluster.affinity_propagation", "sklearn.cluster.AffinityPropagation"),
155+
("sklearn.cluster.spectral_clustering", "sklearn.cluster.SpectralClustering"),
155156
("sklearn.covariance.ledoit_wolf", "sklearn.covariance.LedoitWolf"),
156157
("sklearn.covariance.oas", "sklearn.covariance.OAS"),
157158
("sklearn.decomposition.dict_learning", "sklearn.decomposition.DictionaryLearning"),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.