Skip to content

Commit beb7afc

Browse files
akeshavanamueller
authored andcommitted
fix: replaced check_consistent_length with _check_sample_weigh… (scikit-learn#15471)
1 parent 77aec1f commit beb7afc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sklearn/cluster/_dbscan.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
from scipy import sparse
1515

1616
from ..base import BaseEstimator, ClusterMixin
17-
from ..utils import check_array, check_consistent_length
17+
from ..utils import check_array
18+
from ..utils.validation import _check_sample_weight
1819
from ..neighbors import NearestNeighbors
1920

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

314315
if sample_weight is not None:
315-
sample_weight = np.asarray(sample_weight)
316-
check_consistent_length(X, sample_weight)
316+
sample_weight = _check_sample_weight(sample_weight, X)
317317

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

0 commit comments

Comments
 (0)