Skip to content

Instantly share code, notes, and snippets.

@Alex-Kopylov
Last active February 7, 2019 13:43
Show Gist options
  • Save Alex-Kopylov/bedce14799e3d68378e28d127bd7b50f to your computer and use it in GitHub Desktop.
Save Alex-Kopylov/bedce14799e3d68378e28d127bd7b50f to your computer and use it in GitHub Desktop.
def randomize(dataset, labels):
permutation = np.random.permutation(labels.shape[0])
shuffled_dataset = dataset[permutation,:,:]
shuffled_labels = labels[permutation]
return shuffled_dataset, shuffled_labels
train_dataset, train_labels = randomize(train_dataset, train_labels)
test_dataset, test_labels = randomize(test_dataset, test_labels)
valid_dataset, valid_labels = randomize(valid_dataset, valid_labels)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment