Skip to content

Commit

Permalink
[MRG] Fix numpy FutureWarning (scikit-learn#11704)
Browse files Browse the repository at this point in the history
  • Loading branch information
naoyak authored and jnothman committed Jul 30, 2018
1 parent 9c306c0 commit 774ae89
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sklearn/cluster/birch.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _split_node(node, threshold, branching_factor):

farthest_idx = np.unravel_index(
dist.argmax(), (n_clusters, n_clusters))
node1_dist, node2_dist = dist[[farthest_idx]]
node1_dist, node2_dist = dist[(farthest_idx,)]

node1_closer = node1_dist < node2_dist
for idx, subcluster in enumerate(node.subclusters_):
Expand Down
6 changes: 3 additions & 3 deletions sklearn/feature_extraction/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ def test_extract_patches_strided():
ndim = len(image_shape)

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


Expand Down
6 changes: 4 additions & 2 deletions sklearn/semi_supervised/tests/test_label_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ def test_label_propagation_closed_form():
clf.fit(X, y)
# adopting notation from Zhu et al 2002
T_bar = clf._build_graph()
Tuu = T_bar[np.meshgrid(unlabelled_idx, unlabelled_idx, indexing='ij')]
Tul = T_bar[np.meshgrid(unlabelled_idx, labelled_idx, indexing='ij')]
Tuu = T_bar[tuple(np.meshgrid(unlabelled_idx, unlabelled_idx,
indexing='ij'))]
Tul = T_bar[tuple(np.meshgrid(unlabelled_idx, labelled_idx,
indexing='ij'))]
Y = Y[:, :-1]
Y_l = Y[labelled_idx, :]
Y_u = np.dot(np.dot(np.linalg.inv(np.eye(Tuu.shape[0]) - Tuu), Tul), Y_l)
Expand Down

0 comments on commit 774ae89

Please sign in to comment.