10000 [MRG] Fix numpy FutureWarning (#11704) · scikit-learn/scikit-learn@774ae89 · GitHub
[go: up one dir, main page]

Skip to content

Commit 774ae89

Browse files
naoyakjnothman
authored andcommitted
[MRG] Fix numpy FutureWarning (#11704)
1 parent 9c306c0 commit 774ae89

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

sklearn/cluster/birch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def _split_node(node, threshold, branching_factor):
7474

7575
farthest_idx = np.unravel_index(
7676
dist.argmax(), (n_clusters, n_clusters))
77-
node1_dist, node2_dist = dist[[farthest_idx]]
77+
node1_dist, node2_dist = dist[(farthest_idx,)]
7878

7979
node1_closer = node1_dist < node2_dist
8080
for idx, subcluster in enumerate(node.subclusters_):

sklearn/feature_extraction/tests/test_image.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,9 @@ def test_extract_patches_strided():
304304
ndim = len(image_shape)
305305

306306
assert_true(patches.shape[:ndim] == expected_view)
307-
last_patch_slices = [slice(i, i + j, None) for i, j in
308-
zip(last_patch, patch_size)]
309-
assert_true((patches[[slice(-1, None, None)] * ndim] ==
307+
last_patch_slices = tuple(slice(i, i + j, None) for i, j in
308+
zip(last_patch, patch_size))
309+
assert_true((patches[(-1, None, None) * ndim] ==
310310
image[last_patch_slices].squeeze()).all())
311311

312312

sklearn/semi_supervised/tests/test_label_propagation.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@ def test_label_propagation_closed_form():
113113
clf.fit(X, y)
114114
# adopting notation from Zhu et al 2002
115115
T_bar = clf._build_graph()
116-
Tuu = T_bar[np.meshgrid(unlabelled_idx, unlabelled_idx, indexing='ij')]
117-
Tul = T_bar[np.meshgrid(unlabelled_idx, labelled_idx, indexing='ij')]
116+
Tuu = T_bar[tuple(np.meshgrid(unlabelled_idx, unlabelled_idx,
117+
indexing='ij'))]
118+
Tul = T_bar[tuple(np.meshgrid(unlabelled_idx, labelled_idx,
119+
indexing='ij'))]
118120
Y = Y[:, :-1]
119121
Y_l = Y[labelled_idx, :]
120122
Y_u = np.dot(np.dot(np.linalg.inv(np.eye(Tuu.shape[0]) - Tuu), Tul), Y_l)

0 commit comments

Comments
 (0)
0