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

Skip to content

MAINT Parameters validation for mean_shift() #25684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 24, 2023
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
5 changes: 3 additions & 2 deletions sklearn/cluster/_mean_shift.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def _mean_shift_single_seed(my_mean, X, nbrs, max_iter):
return tuple(my_mean), len(points_within), completed_iterations


@validate_params({"X": ["array-like"]})
def mean_shift(
X,
*,
Expand All @@ -141,9 +142,9 @@ def mean_shift(
Input data.

bandwidth : float, default=None
Kernel bandwidth.
Kernel bandwidth. If not None, must be in the range [0, +inf).

If bandwidth is not given, it is determined using a heuristic based on
If None, the bandwidth is determined using a heuristic based on
the median of all pairwise distances. This will take quadratic time in
the number of samples. The sklearn.cluster.estimate_bandwidth function
can be used to do this more efficiently.
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 @@ -155,6 +155,7 @@ def test_function_param_validation(func_module):

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