8000 fix: replaced check_consistent_length with _check_sample_weight in DBSCAN by akeshavan · Pull Request #15471 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

fix: replaced check_consistent_length with _check_sample_weight in DBSCAN #15471

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 2 commits into from
Nov 2, 2019
Merged
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
E827
Diff view
6 changes: 3 additions & 3 deletions sklearn/cluster/_dbscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from scipy import sparse

from ..base import BaseEstimator, ClusterMixin
from ..utils import check_array, check_consistent_length
from ..utils import check_array
from ..utils.validation import _check_sample_weight
from ..neighbors import NearestNeighbors

from ._dbscan_inner import dbscan_inner
Expand Down Expand Up @@ -312,8 +313,7 @@ def fit(self, X, y=None, sample_weight=None):
raise ValueError("eps must be positive.")

if sample_weight is not None:
sample_weight = np.asarray(sample_weight)
check_consistent_length(X, sample_weight)
sample_weight = _check_sample_weight(sample_weight, X)

# Calculate neighborhood for all samples. This leaves the original
# point in, which needs to be considered later (i.e. point i is in the
Expand Down
0