Created
September 3, 2018 11:55
-
-
Save HViktorTsoi/38503be7eb67fcf6292aeb79dfd3fcd9 to your computer and use it in GitHub Desktop.
numpy shuffle一个或多个有对应关系的矩阵
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
X Y是二维的numpy矩阵 | |
permutation = list(np.random.permutation(m)) | |
shuffled_X = X[:, permutation] | |
shuffled_Y = Y[:, permutation].reshape((1,m)) # reshape是为了保证矩阵不会自动转化为向量 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment