8000 adding safe_indexing to _shuffle function · equialgo/scikit-learn@15a48bf · GitHub
[go: up one dir, main page]

Skip to content

Commit 15a48bf

Browse files
Stijn TonkStijn Tonk
authored andcommitted
adding safe_indexing to _shuffle function
1 parent 9ea5c9e commit 15a48bf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

sklearn/cross_validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1772,7 +1772,7 @@ def _shuffle(y, labels, random_state):
17721772
for label in np.unique(labels):
17731773
this_mask = (labels == label)
17741774
ind[this_mask] = random_state.permutation(ind[this_mask])
1775-
return y[ind]
1775+
return safe_indexing(y, ind)
17761776

17771777

17781778
def check_cv(cv, X=None, y=None, classifier=False):

sklearn/model_selection/_validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ def _shuffle(y, groups, random_state):
636636
for group in np.unique(groups):
637637
this_mask = (groups == group)
638638
indices[this_mask] = random_state.permutation(indices[this_mask])
639-
return y[indices]
639+
return safe_indexing(y, indices)
640640

641641

642642
def learning_curve(estimator, X, y, groups=None,

0 commit comments

Comments
 (0)
0