Wednesday, March 8, 2023

Synchronously shuffle X,Y

    import numpy as np

    np.random.seed(seed) 

    m = X.shape[1]                  # number of training examples    

    permutation = list(np.random.permutation(m))

    shuffled_X = X[:, permutation]

    shuffled_Y = Y[:, permutation].reshape((1, m))

No comments:

Post a Comment