Skip to content

Commit

Permalink
adding safe_indexing to _shuffle function
Browse files Browse the repository at this point in the history
  • Loading branch information
Stijn Tonk authored and Stijn Tonk committed Dec 28, 2016
1 parent 9ea5c9e commit 15a48bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sklearn/cross_validation.py
Expand Up @@ -1772,7 +1772,7 @@ def _shuffle(y, labels, random_state):
for label in np.unique(labels):
this_mask = (labels == label)
ind[this_mask] = random_state.permutation(ind[this_mask])
return y[ind]
return safe_indexing(y, ind)


def check_cv(cv, X=None, y=None, classifier=False):
Expand Down
2 changes: 1 addition & 1 deletion sklearn/model_selection/_validation.py
Expand Up @@ -636,7 +636,7 @@ def _shuffle(y, groups, random_state):
for group in np.unique(groups):
this_mask = (groups == group)
indices[this_mask] = random_state.permutation(indices[this_mask])
return y[indices]
return safe_indexing(y, indices)


def learning_curve(estimator, X, y, groups=None,
Expand Down

0 comments on commit 15a48bf

Please sign in to comment.