Skip to content

Commit 0f2a00f

Browse files
Mridul Sethogrisel
authored andcommitted
Remove dtype conversion warning (scikit-learn#7265)
1 parent ccad485 commit 0f2a00f

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

sklearn/cluster/k_means_.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,8 +860,7 @@ def _check_fit_data(self, X):
860860
return X
861861

862862
def _check_test_data(self, X):
863-
X = check_array(X, accept_sparse='csr', dtype=FLOAT_DTYPES,
864-
warn_on_dtype=True)
863+
X = check_array(X, accept_sparse='csr', dtype=FLOAT_DTYPES)
865864
n_samples, n_features = X.shape
866865
expected_n_features = self.cluster_centers_.shape[1]
867866
if not n_features == expected_n_features:

sklearn/cluster/tests/test_k_means.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,6 @@
4444
X_csr = sp.csr_matrix(X)
4545

4646

47-
def test_kmeans_dtype():
48-
rnd = np.random.RandomState(0)
49-
X = rnd.normal(size=(40, 2))
50-
X = (X * 10).astype(np.uint8)
51-
km = KMeans(n_init=1).fit(X)
52-
pred_x = assert_warns(DataConversionWarning, km.predict, X)
53-
assert_array_equal(km.labels_, pred_x)
54-
55-
5647
def test_elkan_results():
5748
rnd = np.random.RandomState(0)
5849
X_normal = rnd.normal(size=(50, 10))

0 commit comments

Comments
 (0)